2003-06-23 16:55:01 +00:00
|
|
|
/*-
|
2023-05-10 15:40:58 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2017-11-27 15:23:17 +00:00
|
|
|
*
|
2003-06-27 05:13:52 +00:00
|
|
|
* Copyright (c) 2001 Atsushi Onoe
|
2009-01-08 17:12:47 +00:00
|
|
|
* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
|
2003-06-23 16:55:01 +00:00
|
|
|
* 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
|
2003-06-27 05:13:52 +00:00
|
|
|
* 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.
|
2003-06-23 16:55:01 +00:00
|
|
|
*
|
2003-06-27 05:13:52 +00:00
|
|
|
* 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.
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
/*
|
|
|
|
* IEEE 802.11 generic handler
|
|
|
|
*/
|
2008-04-20 20:35:46 +00:00
|
|
|
#include "opt_wlan.h"
|
2003-06-23 16:55:01 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
2009-05-02 15:14:18 +00:00
|
|
|
#include <sys/systm.h>
|
2003-06-23 16:55:01 +00:00
|
|
|
#include <sys/kernel.h>
|
2016-02-01 17:41:21 +00:00
|
|
|
#include <sys/malloc.h>
|
2004-12-08 17:26:47 +00:00
|
|
|
#include <sys/socket.h>
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
#include <sys/sbuf.h>
|
2004-12-08 17:26:47 +00:00
|
|
|
|
2015-05-25 14:30:44 +00:00
|
|
|
#include <machine/stdarg.h>
|
|
|
|
|
2003-06-23 16:55:01 +00:00
|
|
|
#include <net/if.h>
|
2013-10-26 17:58:36 +00:00
|
|
|
#include <net/if_var.h>
|
2008-04-20 20:35:46 +00:00
|
|
|
#include <net/if_dl.h>
|
2003-06-23 16:55:01 +00:00
|
|
|
#include <net/if_media.h>
|
2023-01-23 15:05:29 +00:00
|
|
|
#include <net/if_private.h>
|
2008-04-20 20:35:46 +00:00
|
|
|
#include <net/if_types.h>
|
2003-06-23 16:55:01 +00:00
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
|
|
|
#include <net80211/ieee80211_var.h>
|
2008-04-20 20:35:46 +00:00
|
|
|
#include <net80211/ieee80211_regdomain.h>
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
|
|
|
#include <net80211/ieee80211_superg.h>
|
|
|
|
#endif
|
2010-04-07 15:29:13 +00:00
|
|
|
#include <net80211/ieee80211_ratectl.h>
|
2017-01-13 06:53:56 +00:00
|
|
|
#include <net80211/ieee80211_vht.h>
|
2003-06-23 16:55:01 +00:00
|
|
|
|
|
|
|
#include <net/bpf.h>
|
|
|
|
|
2008-05-11 23:33:56 +00:00
|
|
|
const char *ieee80211_phymode_name[IEEE80211_MODE_MAX] = {
|
|
|
|
[IEEE80211_MODE_AUTO] = "auto",
|
|
|
|
[IEEE80211_MODE_11A] = "11a",
|
|
|
|
[IEEE80211_MODE_11B] = "11b",
|
|
|
|
[IEEE80211_MODE_11G] = "11g",
|
|
|
|
[IEEE80211_MODE_FH] = "FH",
|
|
|
|
[IEEE80211_MODE_TURBO_A] = "turboA",
|
|
|
|
[IEEE80211_MODE_TURBO_G] = "turboG",
|
|
|
|
[IEEE80211_MODE_STURBO_A] = "sturboA",
|
2009-02-19 05:21:54 +00:00
|
|
|
[IEEE80211_MODE_HALF] = "half",
|
|
|
|
[IEEE80211_MODE_QUARTER] = "quarter",
|
2008-05-11 23:33:56 +00:00
|
|
|
[IEEE80211_MODE_11NA] = "11na",
|
|
|
|
[IEEE80211_MODE_11NG] = "11ng",
|
2017-01-10 07:50:21 +00:00
|
|
|
[IEEE80211_MODE_VHT_2GHZ] = "11acg",
|
|
|
|
[IEEE80211_MODE_VHT_5GHZ] = "11ac",
|
2003-06-23 16:55:01 +00:00
|
|
|
};
|
2008-05-12 00:15:30 +00:00
|
|
|
/* map ieee80211_opmode to the corresponding capability bit */
|
|
|
|
const int ieee80211_opcap[IEEE80211_OPMODE_MAX] = {
|
|
|
|
[IEEE80211_M_IBSS] = IEEE80211_C_IBSS,
|
|
|
|
[IEEE80211_M_WDS] = IEEE80211_C_WDS,
|
|
|
|
[IEEE80211_M_STA] = IEEE80211_C_STA,
|
|
|
|
[IEEE80211_M_AHDEMO] = IEEE80211_C_AHDEMO,
|
|
|
|
[IEEE80211_M_HOSTAP] = IEEE80211_C_HOSTAP,
|
|
|
|
[IEEE80211_M_MONITOR] = IEEE80211_C_MONITOR,
|
Implementation of the upcoming Wireless Mesh standard, 802.11s, on the
net80211 wireless stack. This work is based on the March 2009 D3.0 draft
standard. This standard is expected to become final next year.
This includes two main net80211 modules, ieee80211_mesh.c
which deals with peer link management, link metric calculation,
routing table control and mesh configuration and ieee80211_hwmp.c
which deals with the actually routing process on the mesh network.
HWMP is the mandatory routing protocol on by the mesh standard, but
others, such as RA-OLSR, can be implemented.
Authentication and encryption are not implemented.
There are several scripts under tools/tools/net80211/scripts that can be
used to test different mesh network topologies and they also teach you
how to setup a mesh vap (for the impatient: ifconfig wlan0 create
wlandev ... wlanmode mesh).
A new build option is available: IEEE80211_SUPPORT_MESH and it's enabled
by default on GENERIC kernels for i386, amd64, sparc64 and pc98.
Drivers that support mesh networks right now are: ath, ral and mwl.
More information at: http://wiki.freebsd.org/WifiMesh
Please note that this work is experimental. Also, please note that
bridging a mesh vap with another network interface is not yet supported.
Many thanks to the FreeBSD Foundation for sponsoring this project and to
Sam Leffler for his support.
Also, I would like to thank Gateworks Corporation for sending me a
Cambria board which was used during the development of this project.
Reviewed by: sam
Approved by: re (kensmith)
Obtained from: projects/mesh11s
2009-07-11 15:02:45 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_MESH
|
|
|
|
[IEEE80211_M_MBSS] = IEEE80211_C_MBSS,
|
|
|
|
#endif
|
2008-05-12 00:15:30 +00:00
|
|
|
};
|
|
|
|
|
2015-05-26 12:40:27 +00:00
|
|
|
const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] =
|
2008-04-20 20:35:46 +00:00
|
|
|
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
|
|
|
|
|
|
|
static void ieee80211_syncflag_locked(struct ieee80211com *ic, int flag);
|
2009-06-07 22:00:22 +00:00
|
|
|
static void ieee80211_syncflag_ht_locked(struct ieee80211com *ic, int flag);
|
2008-04-20 20:35:46 +00:00
|
|
|
static void ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag);
|
2017-01-07 07:35:27 +00:00
|
|
|
static void ieee80211_syncflag_vht_locked(struct ieee80211com *ic, int flag);
|
2008-04-20 20:35:46 +00:00
|
|
|
static int ieee80211_media_setup(struct ieee80211com *ic,
|
|
|
|
struct ifmedia *media, int caps, int addsta,
|
|
|
|
ifm_change_cb_t media_change, ifm_stat_cb_t media_stat);
|
|
|
|
static int media_status(enum ieee80211_opmode,
|
|
|
|
const struct ieee80211_channel *);
|
2015-05-26 13:19:05 +00:00
|
|
|
static uint64_t ieee80211_get_counter(struct ifnet *, ift_counter);
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
MALLOC_DEFINE(M_80211_VAP, "80211vap", "802.11 vap state");
|
2003-06-23 16:55:01 +00:00
|
|
|
|
2006-11-26 22:48:03 +00:00
|
|
|
/*
|
|
|
|
* Default supported rates for 802.11 operation (in IEEE .5Mb units).
|
|
|
|
*/
|
|
|
|
#define B(r) ((r) | IEEE80211_RATE_BASIC)
|
|
|
|
static const struct ieee80211_rateset ieee80211_rateset_11a =
|
|
|
|
{ 8, { B(12), 18, B(24), 36, B(48), 72, 96, 108 } };
|
2006-12-27 18:46:18 +00:00
|
|
|
static const struct ieee80211_rateset ieee80211_rateset_half =
|
|
|
|
{ 8, { B(6), 9, B(12), 18, B(24), 36, 48, 54 } };
|
|
|
|
static const struct ieee80211_rateset ieee80211_rateset_quarter =
|
|
|
|
{ 8, { B(3), 4, B(6), 9, B(12), 18, 24, 27 } };
|
2006-11-26 22:48:03 +00:00
|
|
|
static const struct ieee80211_rateset ieee80211_rateset_11b =
|
|
|
|
{ 4, { B(2), B(4), B(11), B(22) } };
|
|
|
|
/* NB: OFDM rates are handled specially based on mode */
|
|
|
|
static const struct ieee80211_rateset ieee80211_rateset_11g =
|
|
|
|
{ 12, { B(2), B(4), B(11), B(22), 12, 18, 24, 36, 48, 72, 96, 108 } };
|
|
|
|
#undef B
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
static int set_vht_extchan(struct ieee80211_channel *c);
|
|
|
|
|
2006-12-27 18:46:18 +00:00
|
|
|
/*
|
|
|
|
* Fill in 802.11 available channel set, mark
|
|
|
|
* all available channels as active, and pick
|
|
|
|
* a default channel if not already specified.
|
|
|
|
*/
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
void
|
2006-12-27 18:46:18 +00:00
|
|
|
ieee80211_chan_init(struct ieee80211com *ic)
|
2003-06-23 16:55:01 +00:00
|
|
|
{
|
2006-12-27 18:46:18 +00:00
|
|
|
#define DEFAULTRATES(m, def) do { \
|
2009-02-19 05:21:54 +00:00
|
|
|
if (ic->ic_sup_rates[m].rs_nrates == 0) \
|
2006-12-28 01:31:26 +00:00
|
|
|
ic->ic_sup_rates[m] = def; \
|
2006-12-27 18:46:18 +00:00
|
|
|
} while (0)
|
2003-06-23 16:55:01 +00:00
|
|
|
struct ieee80211_channel *c;
|
|
|
|
int i;
|
|
|
|
|
2008-12-15 01:26:33 +00:00
|
|
|
KASSERT(0 < ic->ic_nchans && ic->ic_nchans <= IEEE80211_CHAN_MAX,
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
("invalid number of channels specified: %u", ic->ic_nchans));
|
2003-06-23 16:55:01 +00:00
|
|
|
memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail));
|
2008-04-20 20:35:46 +00:00
|
|
|
memset(ic->ic_modecaps, 0, sizeof(ic->ic_modecaps));
|
2007-03-11 22:37:32 +00:00
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
for (i = 0; i < ic->ic_nchans; i++) {
|
2003-06-23 16:55:01 +00:00
|
|
|
c = &ic->ic_channels[i];
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
KASSERT(c->ic_flags != 0, ("channel with no flags"));
|
2009-01-27 22:48:46 +00:00
|
|
|
/*
|
|
|
|
* Help drivers that work only with frequencies by filling
|
|
|
|
* in IEEE channel #'s if not already calculated. Note this
|
|
|
|
* mimics similar work done in ieee80211_setregdomain when
|
|
|
|
* changing regulatory state.
|
|
|
|
*/
|
|
|
|
if (c->ic_ieee == 0)
|
|
|
|
c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags);
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup the HT40/VHT40 upper/lower bits.
|
2020-10-07 21:56:58 +00:00
|
|
|
* The VHT80/... math is done elsewhere.
|
2017-01-13 06:53:56 +00:00
|
|
|
*/
|
2009-01-27 22:48:46 +00:00
|
|
|
if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
|
|
|
|
c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
|
|
|
|
(IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20),
|
|
|
|
c->ic_flags);
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
/* Update VHT math */
|
|
|
|
/*
|
2020-10-07 21:56:58 +00:00
|
|
|
* XXX VHT again, note that this assumes VHT80/... channels
|
|
|
|
* are legit already.
|
2017-01-13 06:53:56 +00:00
|
|
|
*/
|
|
|
|
set_vht_extchan(c);
|
|
|
|
|
2009-01-27 22:48:46 +00:00
|
|
|
/* default max tx power to max regulatory */
|
|
|
|
if (c->ic_maxpower == 0)
|
|
|
|
c->ic_maxpower = 2*c->ic_maxregpower;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
setbit(ic->ic_chan_avail, c->ic_ieee);
|
|
|
|
/*
|
|
|
|
* Identify mode capabilities.
|
|
|
|
*/
|
|
|
|
if (IEEE80211_IS_CHAN_A(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_11A);
|
|
|
|
if (IEEE80211_IS_CHAN_B(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_11B);
|
|
|
|
if (IEEE80211_IS_CHAN_ANYG(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_11G);
|
|
|
|
if (IEEE80211_IS_CHAN_FHSS(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_FH);
|
|
|
|
if (IEEE80211_IS_CHAN_108A(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_A);
|
|
|
|
if (IEEE80211_IS_CHAN_108G(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_G);
|
|
|
|
if (IEEE80211_IS_CHAN_ST(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_STURBO_A);
|
2009-02-19 05:21:54 +00:00
|
|
|
if (IEEE80211_IS_CHAN_HALF(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_HALF);
|
|
|
|
if (IEEE80211_IS_CHAN_QUARTER(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_QUARTER);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
if (IEEE80211_IS_CHAN_HTA(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_11NA);
|
|
|
|
if (IEEE80211_IS_CHAN_HTG(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_11NG);
|
2017-01-10 07:50:21 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHTA(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ);
|
|
|
|
if (IEEE80211_IS_CHAN_VHTG(c))
|
|
|
|
setbit(ic->ic_modecaps, IEEE80211_MODE_VHT_2GHZ);
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/* initialize candidate channels to all available */
|
|
|
|
memcpy(ic->ic_chan_active, ic->ic_chan_avail,
|
|
|
|
sizeof(ic->ic_chan_avail));
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
/* sort channel table to allow lookup optimizations */
|
|
|
|
ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans);
|
|
|
|
|
|
|
|
/* invalidate any previous state */
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ic->ic_bsschan = IEEE80211_CHAN_ANYC;
|
2007-09-18 21:54:27 +00:00
|
|
|
ic->ic_prevchan = NULL;
|
2008-04-20 20:35:46 +00:00
|
|
|
ic->ic_csa_newchan = NULL;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/* arbitrarily pick the first channel */
|
|
|
|
ic->ic_curchan = &ic->ic_channels[0];
|
2009-03-29 21:17:08 +00:00
|
|
|
ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
|
2006-11-26 22:48:03 +00:00
|
|
|
|
|
|
|
/* fillin well-known rate sets if driver has not specified */
|
2006-12-27 18:46:18 +00:00
|
|
|
DEFAULTRATES(IEEE80211_MODE_11B, ieee80211_rateset_11b);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_11G, ieee80211_rateset_11g);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_11A, ieee80211_rateset_11a);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_TURBO_A, ieee80211_rateset_11a);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_TURBO_G, ieee80211_rateset_11g);
|
2009-01-29 23:09:12 +00:00
|
|
|
DEFAULTRATES(IEEE80211_MODE_STURBO_A, ieee80211_rateset_11a);
|
2009-02-19 05:21:54 +00:00
|
|
|
DEFAULTRATES(IEEE80211_MODE_HALF, ieee80211_rateset_half);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_QUARTER, ieee80211_rateset_quarter);
|
2009-02-19 04:33:36 +00:00
|
|
|
DEFAULTRATES(IEEE80211_MODE_11NA, ieee80211_rateset_11a);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_11NG, ieee80211_rateset_11g);
|
2017-01-10 07:50:21 +00:00
|
|
|
DEFAULTRATES(IEEE80211_MODE_VHT_2GHZ, ieee80211_rateset_11g);
|
|
|
|
DEFAULTRATES(IEEE80211_MODE_VHT_5GHZ, ieee80211_rateset_11a);
|
2006-12-27 18:46:18 +00:00
|
|
|
|
2011-03-13 11:40:18 +00:00
|
|
|
/*
|
|
|
|
* Setup required information to fill the mcsset field, if driver did
|
|
|
|
* not. Assume a 2T2R setup for historic reasons.
|
|
|
|
*/
|
|
|
|
if (ic->ic_rxstream == 0)
|
|
|
|
ic->ic_rxstream = 2;
|
|
|
|
if (ic->ic_txstream == 0)
|
|
|
|
ic->ic_txstream = 2;
|
|
|
|
|
2017-03-03 01:06:27 +00:00
|
|
|
ieee80211_init_suphtrates(ic);
|
|
|
|
|
2006-12-27 18:46:18 +00:00
|
|
|
/*
|
|
|
|
* Set auto mode to reset active channel state and any desired channel.
|
|
|
|
*/
|
|
|
|
(void) ieee80211_setmode(ic, IEEE80211_MODE_AUTO);
|
|
|
|
#undef DEFAULTRATES
|
|
|
|
}
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
static void
|
2015-05-25 19:53:29 +00:00
|
|
|
null_update_mcast(struct ieee80211com *ic)
|
2008-04-20 20:35:46 +00:00
|
|
|
{
|
2015-05-25 19:53:29 +00:00
|
|
|
|
|
|
|
ic_printf(ic, "need multicast update callback\n");
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-05-25 19:53:29 +00:00
|
|
|
null_update_promisc(struct ieee80211com *ic)
|
2008-04-20 20:35:46 +00:00
|
|
|
{
|
2015-05-25 19:53:29 +00:00
|
|
|
|
|
|
|
ic_printf(ic, "need promiscuous mode update callback\n");
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
|
|
|
|
2012-03-25 03:11:57 +00:00
|
|
|
static void
|
|
|
|
null_update_chw(struct ieee80211com *ic)
|
|
|
|
{
|
|
|
|
|
2015-05-25 14:30:44 +00:00
|
|
|
ic_printf(ic, "%s: need callback\n", __func__);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ic_printf(struct ieee80211com *ic, const char * fmt, ...)
|
2018-07-10 23:30:19 +00:00
|
|
|
{
|
2015-05-25 14:30:44 +00:00
|
|
|
va_list ap;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
retval = printf("%s: ", ic->ic_name);
|
|
|
|
va_start(ap, fmt);
|
|
|
|
retval += vprintf(fmt, ap);
|
2018-07-10 23:30:19 +00:00
|
|
|
va_end(ap);
|
2015-05-25 14:30:44 +00:00
|
|
|
return (retval);
|
2012-03-25 03:11:57 +00:00
|
|
|
}
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
static LIST_HEAD(, ieee80211com) ic_head = LIST_HEAD_INITIALIZER(ic_head);
|
|
|
|
static struct mtx ic_list_mtx;
|
|
|
|
MTX_SYSINIT(ic_list, &ic_list_mtx, "ieee80211com list", MTX_DEF);
|
|
|
|
|
|
|
|
static int
|
|
|
|
sysctl_ieee80211coms(SYSCTL_HANDLER_ARGS)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic;
|
2016-02-26 20:47:08 +00:00
|
|
|
struct sbuf sb;
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
char *sp;
|
|
|
|
int error;
|
|
|
|
|
2016-02-26 20:47:08 +00:00
|
|
|
error = sysctl_wire_old_buffer(req, 0);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
sbuf_new_for_sysctl(&sb, NULL, 8, req);
|
|
|
|
sbuf_clear_flags(&sb, SBUF_INCLUDENUL);
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
sp = "";
|
|
|
|
mtx_lock(&ic_list_mtx);
|
|
|
|
LIST_FOREACH(ic, &ic_head, ic_next) {
|
2016-02-26 20:47:08 +00:00
|
|
|
sbuf_printf(&sb, "%s%s", sp, ic->ic_name);
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
sp = " ";
|
|
|
|
}
|
|
|
|
mtx_unlock(&ic_list_mtx);
|
2016-02-26 20:47:08 +00:00
|
|
|
error = sbuf_finish(&sb);
|
|
|
|
sbuf_delete(&sb);
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
SYSCTL_PROC(_net_wlan, OID_AUTO, devices,
|
|
|
|
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
|
|
|
|
sysctl_ieee80211coms, "A", "names of available 802.11 devices");
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
/*
|
|
|
|
* Attach/setup the common net80211 state. Called by
|
|
|
|
* the driver on attach to prior to creating any vap's.
|
|
|
|
*/
|
2006-12-27 18:46:18 +00:00
|
|
|
void
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
ieee80211_ifattach(struct ieee80211com *ic)
|
2006-12-27 18:46:18 +00:00
|
|
|
{
|
|
|
|
|
2015-05-25 14:30:44 +00:00
|
|
|
IEEE80211_LOCK_INIT(ic, ic->ic_name);
|
|
|
|
IEEE80211_TX_LOCK_INIT(ic, ic->ic_name);
|
2008-04-20 20:35:46 +00:00
|
|
|
TAILQ_INIT(&ic->ic_vaps);
|
2009-05-02 15:14:18 +00:00
|
|
|
|
|
|
|
/* Create a taskqueue for all state changes */
|
2022-08-17 18:33:08 +00:00
|
|
|
ic->ic_tq = taskqueue_create("ic_taskq",
|
|
|
|
IEEE80211_M_WAITOK | IEEE80211_M_ZERO,
|
2009-05-02 15:14:18 +00:00
|
|
|
taskqueue_thread_enqueue, &ic->ic_tq);
|
2012-01-22 05:30:29 +00:00
|
|
|
taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq",
|
2015-05-26 12:06:36 +00:00
|
|
|
ic->ic_name);
|
2022-08-17 18:33:08 +00:00
|
|
|
ic->ic_ierrors = counter_u64_alloc(IEEE80211_M_WAITOK);
|
|
|
|
ic->ic_oerrors = counter_u64_alloc(IEEE80211_M_WAITOK);
|
2006-12-27 18:46:18 +00:00
|
|
|
/*
|
|
|
|
* Fill in 802.11 available channel set, mark all
|
|
|
|
* available channels as active, and pick a default
|
|
|
|
* channel if not already specified.
|
|
|
|
*/
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
ieee80211_chan_init(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
ic->ic_update_mcast = null_update_mcast;
|
|
|
|
ic->ic_update_promisc = null_update_promisc;
|
2012-03-25 03:11:57 +00:00
|
|
|
ic->ic_update_chw = null_update_chw;
|
2003-06-23 16:55:01 +00:00
|
|
|
|
2009-07-05 18:17:37 +00:00
|
|
|
ic->ic_hash_key = arc4random();
|
2006-02-14 17:48:56 +00:00
|
|
|
ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT;
|
|
|
|
ic->ic_lintval = ic->ic_bintval;
|
2004-12-08 17:26:47 +00:00
|
|
|
ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
|
2003-06-23 16:55:01 +00:00
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_crypto_attach(ic);
|
2004-12-08 17:26:47 +00:00
|
|
|
ieee80211_node_attach(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_power_attach(ic);
|
2004-12-08 17:26:47 +00:00
|
|
|
ieee80211_proto_attach(ic);
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
|
|
|
ieee80211_superg_attach(ic);
|
|
|
|
#endif
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_ht_attach(ic);
|
2017-01-13 06:53:56 +00:00
|
|
|
ieee80211_vht_attach(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_scan_attach(ic);
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_regdomain_attach(ic);
|
2009-06-09 17:11:41 +00:00
|
|
|
ieee80211_dfs_attach(ic);
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
ieee80211_sysctl_attach(ic);
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
mtx_lock(&ic_list_mtx);
|
|
|
|
LIST_INSERT_HEAD(&ic_head, ic, ic_next);
|
|
|
|
mtx_unlock(&ic_list_mtx);
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
/*
|
|
|
|
* Detach net80211 state on device detach. Tear down
|
|
|
|
* all vap's and reclaim all common state prior to the
|
|
|
|
* device state going away. Note we may call back into
|
|
|
|
* driver; it must be prepared for this.
|
|
|
|
*/
|
2003-06-23 16:55:01 +00:00
|
|
|
void
|
2004-12-08 17:26:47 +00:00
|
|
|
ieee80211_ifdetach(struct ieee80211com *ic)
|
2003-06-23 16:55:01 +00:00
|
|
|
{
|
2008-04-20 20:35:46 +00:00
|
|
|
struct ieee80211vap *vap;
|
2003-06-23 16:55:01 +00:00
|
|
|
|
2018-07-10 23:30:19 +00:00
|
|
|
/*
|
|
|
|
* We use this as an indicator that ifattach never had a chance to be
|
|
|
|
* called, e.g. early driver attach failed and ifdetach was called
|
|
|
|
* during subsequent detach. Never fear, for we have nothing to do
|
|
|
|
* here.
|
|
|
|
*/
|
|
|
|
if (ic->ic_tq == NULL)
|
|
|
|
return;
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
mtx_lock(&ic_list_mtx);
|
|
|
|
LIST_REMOVE(ic, ic_next);
|
|
|
|
mtx_unlock(&ic_list_mtx);
|
2009-06-02 18:55:27 +00:00
|
|
|
|
2015-10-27 20:40:57 +00:00
|
|
|
taskqueue_drain(taskqueue_thread, &ic->ic_restart_task);
|
|
|
|
|
2012-10-26 16:56:55 +00:00
|
|
|
/*
|
|
|
|
* The VAP is responsible for setting and clearing
|
|
|
|
* the VIMAGE context.
|
|
|
|
*/
|
2019-01-20 13:39:18 +00:00
|
|
|
while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) {
|
|
|
|
ieee80211_com_vdetach(vap);
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_vap_destroy(vap);
|
2019-01-20 13:39:18 +00:00
|
|
|
}
|
2009-02-12 18:57:18 +00:00
|
|
|
ieee80211_waitfor_parent(ic);
|
2004-12-08 17:26:47 +00:00
|
|
|
|
|
|
|
ieee80211_sysctl_detach(ic);
|
2009-06-09 17:11:41 +00:00
|
|
|
ieee80211_dfs_detach(ic);
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_regdomain_detach(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_scan_detach(ic);
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
|
|
|
ieee80211_superg_detach(ic);
|
|
|
|
#endif
|
2017-01-13 06:53:56 +00:00
|
|
|
ieee80211_vht_detach(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_ht_detach(ic);
|
2007-01-15 01:12:28 +00:00
|
|
|
/* NB: must be called before ieee80211_node_detach */
|
2004-12-08 17:26:47 +00:00
|
|
|
ieee80211_proto_detach(ic);
|
|
|
|
ieee80211_crypto_detach(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_power_detach(ic);
|
2004-12-08 17:26:47 +00:00
|
|
|
ieee80211_node_detach(ic);
|
|
|
|
|
2015-05-26 13:19:05 +00:00
|
|
|
counter_u64_free(ic->ic_ierrors);
|
|
|
|
counter_u64_free(ic->ic_oerrors);
|
2012-10-26 16:56:55 +00:00
|
|
|
|
2009-05-02 15:14:18 +00:00
|
|
|
taskqueue_free(ic->ic_tq);
|
Bring over my initial work from the net80211 TX locking branch.
This patchset implements a new TX lock, covering both the per-VAP (and
thus per-node) TX locking and the serialisation through to the underlying
physical device.
This implements the hard requirement that frames to the underlying physical
device are scheduled to the underlying device in the same order that they
are processed at the VAP layer. This includes adding extra encapsulation
state (such as sequence numbers and CCMP IV numbers.) Any order mismatch
here will result in dropped packets at the receiver.
There are multiple transmit contexts from the upper protocol layers as well
as the "raw" interface via the management and BPF transmit paths.
All of these need to be correctly serialised or bad behaviour will result
under load.
The specifics:
* add a new TX IC lock - it will eventually just be used for serialisation
to the underlying physical device but for now it's used for both the
VAP encapsulation/serialisation and the physical device dispatch.
This lock is specifically non-recursive.
* Methodize the parent transmit, vap transmit and ic_raw_xmit function
pointers; use lock assertions in the parent/vap transmit routines.
* Add a lock assertion in ieee80211_encap() - the TX lock must be held
here to guarantee sensible behaviour.
* Refactor out the packet sending code from ieee80211_start() - now
ieee80211_start() is just a loop over the ifnet queue and it dispatches
each VAP packet send through ieee80211_start_pkt().
Yes, I will likely rename ieee80211_start_pkt() to something that
better reflects its status as a VAP packet transmit path. More on
that later.
* Add locking around the management and BAR TX sending - to ensure that
encapsulation and TX are done hand-in-hand.
* Add locking in the mesh code - again, to ensure that encapsulation
and mesh transmit are done hand-in-hand.
* Add locking around the power save queue and ageq handling, when
dispatching to the parent interface.
* Add locking around the WDS handoff.
* Add a note in the mesh dispatch code that the TX path needs to be
re-thought-out - right now it's doing a direct parent device transmit
rather than going via the vap layer. It may "work", but it's likely
incorrect (as it bypasses any possible per-node power save and
aggregation handling.)
Why not a per-VAP or per-node lock?
Because in order to ensure per-VAP ordering, we'd have to hold the
VAP lock across parent->if_transmit(). There are a few problems
with this:
* There's some state being setup during each driver transmit - specifically,
the encryption encap / CCMP IV setup. That should eventually be dragged
back into the encapsulation phase but for now it lives in the driver TX path.
This should be locked.
* Two drivers (ath, iwn) re-use the node->ni_txseqs array in order to
allocate sequence numbers when doing transmit aggregation. This should
also be locked.
* Drivers may have multiple frames queued already - so when one calls
if_transmit(), it may end up dispatching multiple frames for different
VAPs/nodes, each needing a different lock when handling that particular
end destination.
So to be "correct" locking-wise, we'd end up needing to grab a VAP or
node lock inside the driver TX path when setting up crypto / AMPDU sequence
numbers, and we may already _have_ a TX lock held - mostly for the same
destination vap/node, but sometimes it'll be for others. That could lead
to LORs and thus deadlocks.
So for now, I'm sticking with an IC TX lock. It has the advantage of
papering over the above and it also has the added advantage that I can
assert that it's being held when doing a parent device transmit.
I'll look at splitting the locks out a bit more later on.
General outstanding net80211 TX path issues / TODO:
* Look into separating out the VAP serialisation and the IC handoff.
It's going to be tricky as parent->if_transmit() doesn't give me the
opportunity to split queuing from driver dispatch. See above.
* Work with monthadar to fix up the mesh transmit path so it doesn't go via
the parent interface when retransmitting frames.
* Push the encryption handling back into the driver, if it's at all
architectually sane to do so. I know it's possible - it's what mac80211
in Linux does.
* Make ieee80211_raw_xmit() queue a frame into VAP or parent queue rather
than doing a short-cut direct into the driver. There are QoS issues
here - you do want your management frames to be encapsulated and pushed
onto the stack sooner than the (large, bursty) amount of data frames
that are queued. But there has to be a saner way to do this.
* Fragments are still broken - drivers need to be upgraded to an if_transmit()
implementation and then fragmentation handling needs to be properly fixed.
Tested:
* STA - AR5416, AR9280, Intel 5300 abgn wifi
* Hostap - AR5416, AR9160, AR9280
* Mesh - some testing by monthadar@, more to come.
2013-03-08 20:23:55 +00:00
|
|
|
IEEE80211_TX_LOCK_DESTROY(ic);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
IEEE80211_LOCK_DESTROY(ic);
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
struct ieee80211com *
|
|
|
|
ieee80211_find_com(const char *name)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic;
|
|
|
|
|
|
|
|
mtx_lock(&ic_list_mtx);
|
|
|
|
LIST_FOREACH(ic, &ic_head, ic_next)
|
|
|
|
if (strcmp(ic->ic_name, name) == 0)
|
|
|
|
break;
|
|
|
|
mtx_unlock(&ic_list_mtx);
|
|
|
|
|
|
|
|
return (ic);
|
|
|
|
}
|
|
|
|
|
2016-05-17 16:38:18 +00:00
|
|
|
void
|
|
|
|
ieee80211_iterate_coms(ieee80211_com_iter_func *f, void *arg)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic;
|
|
|
|
|
|
|
|
mtx_lock(&ic_list_mtx);
|
|
|
|
LIST_FOREACH(ic, &ic_head, ic_next)
|
|
|
|
(*f)(arg, ic);
|
|
|
|
mtx_unlock(&ic_list_mtx);
|
|
|
|
}
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
/*
|
|
|
|
* Default reset method for use with the ioctl support. This
|
|
|
|
* method is invoked after any state change in the 802.11
|
|
|
|
* layer that should be propagated to the hardware but not
|
|
|
|
* require re-initialization of the 802.11 state machine (e.g
|
|
|
|
* rescanning for an ap). We always return ENETRESET which
|
|
|
|
* should cause the driver to re-initialize the device. Drivers
|
|
|
|
* can override this method to implement more optimized support.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
default_reset(struct ieee80211vap *vap, u_long cmd)
|
|
|
|
{
|
|
|
|
return ENETRESET;
|
|
|
|
}
|
2004-12-08 17:26:47 +00:00
|
|
|
|
[net80211] turn the default TX key configuration (for WEP) into a vap callback.
The ath10k firmware supports hardware WEP offload, and in native wifi mode
(or 802.3 ethernet mode, for that matter) the WEP key isn't actually included
in the TX payload from net80211. Instead, a separate firmware command is issued
that sets the default TX key to be the specified key.
However, net80211 doesn't at all inform the driver layer that this is
occuring - it just "expects" to be inserting WEP header information
when doing WEP TX, even with hardware encryption.
So, to better support the newer world order, turn the default TX key assignment
into a VAP method that can be overridden by the driver and ensure its wrapped
in a crypto begin/end set. That way it should be correctly atomic from the
point of view of keychanges (as long as the driver does the right thing.)
It'd be nice if we passed through to the key_set call a flag that says
"also make this the default key" - that's captured here by calling the
deftxkey method after the key_set method. Maybe I can do that later.
Note: this is a net80211 ABI change, and will require a kernel+modules
recompile. Happy Holidays, etc.
Tested:
* ath10k driver port
* rtwn_usb, WEP station
2016-12-27 06:10:28 +00:00
|
|
|
/*
|
|
|
|
* Default for updating the VAP default TX key index.
|
|
|
|
*
|
|
|
|
* Drivers that support TX offload as well as hardware encryption offload
|
|
|
|
* may need to be informed of key index changes separate from the key
|
|
|
|
* update.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
default_update_deftxkey(struct ieee80211vap *vap, ieee80211_keyix kid)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* XXX assert validity */
|
|
|
|
/* XXX assert we're in a key update block */
|
|
|
|
vap->iv_def_txkey = kid;
|
|
|
|
}
|
|
|
|
|
2015-05-26 13:19:05 +00:00
|
|
|
/*
|
|
|
|
* Add underlying device errors to vap errors.
|
|
|
|
*/
|
|
|
|
static uint64_t
|
|
|
|
ieee80211_get_counter(struct ifnet *ifp, ift_counter cnt)
|
|
|
|
{
|
|
|
|
struct ieee80211vap *vap = ifp->if_softc;
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
uint64_t rv;
|
|
|
|
|
|
|
|
rv = if_get_counter_default(ifp, cnt);
|
|
|
|
switch (cnt) {
|
|
|
|
case IFCOUNTER_OERRORS:
|
|
|
|
rv += counter_u64_fetch(ic->ic_oerrors);
|
|
|
|
break;
|
|
|
|
case IFCOUNTER_IERRORS:
|
|
|
|
rv += counter_u64_fetch(ic->ic_ierrors);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
/*
|
|
|
|
* Prepare a vap for use. Drivers use this call to
|
|
|
|
* setup net80211 state in new vap's prior attaching
|
|
|
|
* them with ieee80211_vap_attach (below).
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
2011-12-17 10:23:17 +00:00
|
|
|
const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode,
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
int flags, const uint8_t bssid[IEEE80211_ADDR_LEN])
|
2008-04-20 20:35:46 +00:00
|
|
|
{
|
|
|
|
struct ifnet *ifp;
|
|
|
|
|
|
|
|
ifp = if_alloc(IFT_ETHER);
|
|
|
|
if (ifp == NULL) {
|
2020-08-17 16:28:59 +00:00
|
|
|
ic_printf(ic, "%s: unable to allocate ifnet\n", __func__);
|
2008-04-20 20:35:46 +00:00
|
|
|
return ENOMEM;
|
|
|
|
}
|
|
|
|
if_initname(ifp, name, unit);
|
|
|
|
ifp->if_softc = vap; /* back pointer */
|
|
|
|
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
2013-08-08 05:09:35 +00:00
|
|
|
ifp->if_transmit = ieee80211_vap_transmit;
|
|
|
|
ifp->if_qflush = ieee80211_vap_qflush;
|
2008-04-20 20:35:46 +00:00
|
|
|
ifp->if_ioctl = ieee80211_ioctl;
|
|
|
|
ifp->if_init = ieee80211_init;
|
2015-05-26 13:19:05 +00:00
|
|
|
ifp->if_get_counter = ieee80211_get_counter;
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
vap->iv_ifp = ifp;
|
|
|
|
vap->iv_ic = ic;
|
|
|
|
vap->iv_flags = ic->ic_flags; /* propagate common flags */
|
|
|
|
vap->iv_flags_ext = ic->ic_flags_ext;
|
|
|
|
vap->iv_flags_ven = ic->ic_flags_ven;
|
|
|
|
vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
/* 11n capabilities - XXX methodize */
|
2008-04-20 20:35:46 +00:00
|
|
|
vap->iv_htcaps = ic->ic_htcaps;
|
2010-03-23 12:03:09 +00:00
|
|
|
vap->iv_htextcaps = ic->ic_htextcaps;
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
/* 11ac capabilities - XXX methodize */
|
|
|
|
vap->iv_vhtcaps = ic->ic_vhtcaps;
|
|
|
|
vap->iv_vhtextcaps = ic->ic_vhtextcaps;
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
vap->iv_opmode = opmode;
|
2008-05-12 00:15:30 +00:00
|
|
|
vap->iv_caps |= ieee80211_opcap[opmode];
|
2016-04-05 21:29:11 +00:00
|
|
|
IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr);
|
2008-04-20 20:35:46 +00:00
|
|
|
switch (opmode) {
|
|
|
|
case IEEE80211_M_WDS:
|
|
|
|
/*
|
|
|
|
* WDS links must specify the bssid of the far end.
|
|
|
|
* For legacy operation this is a static relationship.
|
|
|
|
* For non-legacy operation the station must associate
|
|
|
|
* and be authorized to pass traffic. Plumbing the
|
|
|
|
* vap to the proper node happens when the vap
|
|
|
|
* transitions to RUN state.
|
|
|
|
*/
|
|
|
|
IEEE80211_ADDR_COPY(vap->iv_des_bssid, bssid);
|
|
|
|
vap->iv_flags |= IEEE80211_F_DESBSSID;
|
|
|
|
if (flags & IEEE80211_CLONE_WDSLEGACY)
|
|
|
|
vap->iv_flags_ext |= IEEE80211_FEXT_WDSLEGACY;
|
|
|
|
break;
|
2009-01-08 17:12:47 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_TDMA
|
|
|
|
case IEEE80211_M_AHDEMO:
|
|
|
|
if (flags & IEEE80211_CLONE_TDMA) {
|
|
|
|
/* NB: checked before clone operation allowed */
|
|
|
|
KASSERT(ic->ic_caps & IEEE80211_C_TDMA,
|
|
|
|
("not TDMA capable, ic_caps 0x%x", ic->ic_caps));
|
|
|
|
/*
|
|
|
|
* Propagate TDMA capability to mark vap; this
|
|
|
|
* cannot be removed and is used to distinguish
|
|
|
|
* regular ahdemo operation from ahdemo+tdma.
|
|
|
|
*/
|
|
|
|
vap->iv_caps |= IEEE80211_C_TDMA;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
2011-12-17 10:23:17 +00:00
|
|
|
default:
|
|
|
|
break;
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
2008-10-25 23:43:08 +00:00
|
|
|
/* auto-enable s/w beacon miss support */
|
|
|
|
if (flags & IEEE80211_CLONE_NOBEACONS)
|
|
|
|
vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
|
2010-01-19 05:00:57 +00:00
|
|
|
/* auto-generated or user supplied MAC address */
|
|
|
|
if (flags & (IEEE80211_CLONE_BSSID|IEEE80211_CLONE_MACADDR))
|
|
|
|
vap->iv_flags_ext |= IEEE80211_FEXT_UNIQMAC;
|
2008-04-20 20:35:46 +00:00
|
|
|
/*
|
|
|
|
* Enable various functionality by default if we're
|
|
|
|
* capable; the driver can override us if it knows better.
|
|
|
|
*/
|
|
|
|
if (vap->iv_caps & IEEE80211_C_WME)
|
|
|
|
vap->iv_flags |= IEEE80211_F_WME;
|
|
|
|
if (vap->iv_caps & IEEE80211_C_BURST)
|
|
|
|
vap->iv_flags |= IEEE80211_F_BURST;
|
|
|
|
/* NB: bg scanning only makes sense for station mode right now */
|
|
|
|
if (vap->iv_opmode == IEEE80211_M_STA &&
|
|
|
|
(vap->iv_caps & IEEE80211_C_BGSCAN))
|
|
|
|
vap->iv_flags |= IEEE80211_F_BGSCAN;
|
2008-05-12 00:15:30 +00:00
|
|
|
vap->iv_flags |= IEEE80211_F_DOTH; /* XXX no cap, just ena */
|
2008-05-11 23:32:07 +00:00
|
|
|
/* NB: DFS support only makes sense for ap mode right now */
|
|
|
|
if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
|
|
|
|
(vap->iv_caps & IEEE80211_C_DFS))
|
2008-04-20 20:35:46 +00:00
|
|
|
vap->iv_flags_ext |= IEEE80211_FEXT_DFS;
|
2020-06-16 00:27:32 +00:00
|
|
|
/* NB: only flip on U-APSD for hostap/sta for now */
|
|
|
|
if ((vap->iv_opmode == IEEE80211_M_STA)
|
|
|
|
|| (vap->iv_opmode == IEEE80211_M_HOSTAP)) {
|
|
|
|
if (vap->iv_caps & IEEE80211_C_UAPSD)
|
|
|
|
vap->iv_flags_ext |= IEEE80211_FEXT_UAPSD;
|
|
|
|
}
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
vap->iv_des_chan = IEEE80211_CHAN_ANYC; /* any channel is ok */
|
|
|
|
vap->iv_bmissthreshold = IEEE80211_HWBMISS_DEFAULT;
|
|
|
|
vap->iv_dtim_period = IEEE80211_DTIM_DEFAULT;
|
|
|
|
/*
|
|
|
|
* Install a default reset method for the ioctl support;
|
|
|
|
* the driver can override this.
|
|
|
|
*/
|
|
|
|
vap->iv_reset = default_reset;
|
|
|
|
|
[net80211] turn the default TX key configuration (for WEP) into a vap callback.
The ath10k firmware supports hardware WEP offload, and in native wifi mode
(or 802.3 ethernet mode, for that matter) the WEP key isn't actually included
in the TX payload from net80211. Instead, a separate firmware command is issued
that sets the default TX key to be the specified key.
However, net80211 doesn't at all inform the driver layer that this is
occuring - it just "expects" to be inserting WEP header information
when doing WEP TX, even with hardware encryption.
So, to better support the newer world order, turn the default TX key assignment
into a VAP method that can be overridden by the driver and ensure its wrapped
in a crypto begin/end set. That way it should be correctly atomic from the
point of view of keychanges (as long as the driver does the right thing.)
It'd be nice if we passed through to the key_set call a flag that says
"also make this the default key" - that's captured here by calling the
deftxkey method after the key_set method. Maybe I can do that later.
Note: this is a net80211 ABI change, and will require a kernel+modules
recompile. Happy Holidays, etc.
Tested:
* ath10k driver port
* rtwn_usb, WEP station
2016-12-27 06:10:28 +00:00
|
|
|
/*
|
|
|
|
* Install a default crypto key update method, the driver
|
|
|
|
* can override this.
|
|
|
|
*/
|
|
|
|
vap->iv_update_deftxkey = default_update_deftxkey;
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_sysctl_vattach(vap);
|
|
|
|
ieee80211_crypto_vattach(vap);
|
|
|
|
ieee80211_node_vattach(vap);
|
|
|
|
ieee80211_power_vattach(vap);
|
|
|
|
ieee80211_proto_vattach(vap);
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
|
|
|
ieee80211_superg_vattach(vap);
|
|
|
|
#endif
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_ht_vattach(vap);
|
2017-01-13 06:53:56 +00:00
|
|
|
ieee80211_vht_vattach(vap);
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_scan_vattach(vap);
|
|
|
|
ieee80211_regdomain_vattach(vap);
|
2009-05-20 20:00:40 +00:00
|
|
|
ieee80211_radiotap_vattach(vap);
|
[net80211] Migrate short slot time configuration into per-vap and deferred taskqueue updates.
The 11b/11g ERP and slot time update handling are two things which weren't
migrated into the per-VAP state when Sam did the initial VAP work.
That makes sense for a lot of setups where net80211 is driving radio state
and the radio only cares about the shared state.
However, as noted by a now deleted comment, the ERP and slot time updates
aren't EXACTLY correct/accurate - they only take into account the most
RECENTLY created VAP, and the state updates when one creates/destroys
VAPs isn't exactly great.
So:
* track the short slot logic per VAP;
* whenever the slot time configuration changes, just push it into a deferred
task queue update so drivers don't have to serialise it themselves;
* if a driver registers a per-VAP slot time handler then it'll just get the
per VAP one;
* .. if a driver registers a global one then the legacy behaviour is maintained -
a single slot time is calculated and pushed out.
Note that the calculated slot time is better than the existing logic - if ANY
of the VAPs require long slot then it's disabled for all VAPs rather than
whatever the last configured VAP did.
Now, this isn't entirely complete - the rest of ERP tracking around short/long
slot capable station tracking needs to be converted into per-VAP, as well
as the preamble/barker flags. Luckily those also can be done in a similar
fashion - keep per-VAP counters/flags and unify them before doing the driver
update. I'll defer that work until later.
All the existing drivers can keep doing what they're doing with the global
slot time flags as that is maintained. One driver (iwi) used the per-VAP
flags instead of the ic flags, so now that driver will work properly.
This unblocks some ath10k porting work as the firmware takes the slot time
configuration per-VAP rather than globally, and some firmware handles
STA+AP and STA+STA (on same/different channels) configurations where
the firmware will switch slot time as appropriate.
Tested:
* AR9380, STA/AP mode
* AR9880 (ath10k), STA mode
2020-06-05 06:21:23 +00:00
|
|
|
ieee80211_vap_reset_erp(vap);
|
2010-11-06 18:17:20 +00:00
|
|
|
ieee80211_ratectl_set(vap, IEEE80211_RATECTL_NONE);
|
2010-04-07 15:29:13 +00:00
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Activate a vap. State should have been prepared with a
|
|
|
|
* call to ieee80211_vap_setup and by the driver. On return
|
|
|
|
* from this call the vap is ready for use.
|
|
|
|
*/
|
|
|
|
int
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
ieee80211_vap_attach(struct ieee80211vap *vap, ifm_change_cb_t media_change,
|
|
|
|
ifm_stat_cb_t media_stat, const uint8_t macaddr[IEEE80211_ADDR_LEN])
|
2008-04-20 20:35:46 +00:00
|
|
|
{
|
|
|
|
struct ifnet *ifp = vap->iv_ifp;
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
struct ifmediareq imr;
|
|
|
|
int maxrate;
|
|
|
|
|
|
|
|
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
|
|
|
|
"%s: %s parent %s flags 0x%x flags_ext 0x%x\n",
|
|
|
|
__func__, ieee80211_opmode_name[vap->iv_opmode],
|
2015-05-25 14:30:44 +00:00
|
|
|
ic->ic_name, vap->iv_flags, vap->iv_flags_ext);
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do late attach work that cannot happen until after
|
|
|
|
* the driver has had a chance to override defaults.
|
|
|
|
*/
|
|
|
|
ieee80211_node_latevattach(vap);
|
|
|
|
ieee80211_power_latevattach(vap);
|
|
|
|
|
|
|
|
maxrate = ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps,
|
|
|
|
vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat);
|
|
|
|
ieee80211_media_status(ifp, &imr);
|
|
|
|
/* NB: strip explicit mode; we're actually in autoselect */
|
2009-02-03 22:32:26 +00:00
|
|
|
ifmedia_set(&vap->iv_media,
|
|
|
|
imr.ifm_active &~ (IFM_MMASK | IFM_IEEE80211_TURBO));
|
2008-04-20 20:35:46 +00:00
|
|
|
if (maxrate)
|
|
|
|
ifp->if_baudrate = IF_Mbps(maxrate);
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
ether_ifattach(ifp, macaddr);
|
2016-04-05 21:29:11 +00:00
|
|
|
IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp));
|
2014-08-10 08:35:42 +00:00
|
|
|
/* hook output method setup by ether_ifattach */
|
|
|
|
vap->iv_output = ifp->if_output;
|
|
|
|
ifp->if_output = ieee80211_output;
|
2008-04-20 20:35:46 +00:00
|
|
|
/* NB: if_mtu set by ether_ifattach to ETHERMTU */
|
|
|
|
|
|
|
|
IEEE80211_LOCK(ic);
|
|
|
|
TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next);
|
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP);
|
2009-03-24 20:39:08 +00:00
|
|
|
#endif
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_PCF);
|
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
|
2009-06-07 22:00:22 +00:00
|
|
|
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
|
|
|
|
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
|
2017-01-07 07:35:27 +00:00
|
|
|
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
|
2020-10-07 21:56:58 +00:00
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
|
2008-04-20 20:35:46 +00:00
|
|
|
IEEE80211_UNLOCK(ic);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-07-10 23:30:19 +00:00
|
|
|
/*
|
2008-04-20 20:35:46 +00:00
|
|
|
* Tear down vap state and reclaim the ifnet.
|
|
|
|
* The driver is assumed to have prepared for
|
|
|
|
* this; e.g. by turning off interrupts for the
|
|
|
|
* underlying device.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ieee80211_vap_detach(struct ieee80211vap *vap)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
struct ifnet *ifp = vap->iv_ifp;
|
|
|
|
|
2012-10-26 16:56:55 +00:00
|
|
|
CURVNET_SET(ifp->if_vnet);
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s parent %s\n",
|
2015-05-26 12:06:36 +00:00
|
|
|
__func__, ieee80211_opmode_name[vap->iv_opmode], ic->ic_name);
|
2008-04-20 20:35:46 +00:00
|
|
|
|
2009-06-02 16:57:27 +00:00
|
|
|
/* NB: bpfdetach is called by ether_ifdetach and claims all taps */
|
|
|
|
ether_ifdetach(ifp);
|
|
|
|
|
|
|
|
ieee80211_stop(vap);
|
2009-05-02 15:14:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Flush any deferred vap tasks.
|
|
|
|
*/
|
|
|
|
ieee80211_draintask(ic, &vap->iv_nstate_task);
|
|
|
|
ieee80211_draintask(ic, &vap->iv_swbmiss_task);
|
[net80211] begin fleshing out per-VAP WME configurations.
As part of (eventual) p2p/tdls/multi-STA support, a lot of global configuration
parameters (WME, ERP (slot, preamble), channel width, HT protmode, etc are the
biggest offenders) should be per-VAP.
For multi-BSS VAP operation they may be linked, but for p2p/TDLS
operation that can be off-channel they can definitely be different
(think: 2GHz STA, 5GHz p2p.)
The global configuration view of these is mostly a "configure the current
non-smart-firmware NIC" view. This should be split up into per-VAP state,
then a global non-smart-firmware-NIC management layer to handle channel
changes and such in software.
This is step one in a loooong road for this. It should be a big non-functional
change for everyone.
* create a per-VAP WME update call.
* call it if its set, and call the global callback if it isn't
This still uses global WME state - it's just preparation for a future change
which will make the WME state per-VAP and fall through to a shared WME
configuration for hostap operation.
Note: this requires a full kernel recompile; the internal net80211 ABI has changed.
Reviewed by: avos
Differential Revision: https://reviews.freebsd.org/D9986
2017-03-13 16:44:06 +00:00
|
|
|
ieee80211_draintask(ic, &vap->iv_wme_task);
|
2017-03-24 22:29:51 +00:00
|
|
|
ieee80211_draintask(ic, &ic->ic_parent_task);
|
2008-04-20 20:35:46 +00:00
|
|
|
|
2009-08-12 21:19:19 +00:00
|
|
|
/* XXX band-aid until ifnet handles this for us */
|
|
|
|
taskqueue_drain(taskqueue_swi, &ifp->if_linktask);
|
|
|
|
|
2009-05-02 15:14:18 +00:00
|
|
|
IEEE80211_LOCK(ic);
|
|
|
|
KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running"));
|
2008-04-20 20:35:46 +00:00
|
|
|
TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
|
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP);
|
2009-03-24 20:39:08 +00:00
|
|
|
#endif
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_PCF);
|
|
|
|
ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
|
2009-06-07 22:00:22 +00:00
|
|
|
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
|
|
|
|
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
|
2017-01-07 07:35:27 +00:00
|
|
|
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
|
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
|
2020-10-07 21:56:58 +00:00
|
|
|
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
|
2017-01-07 07:35:27 +00:00
|
|
|
|
2009-05-20 20:00:40 +00:00
|
|
|
/* NB: this handles the bpfdetach done below */
|
|
|
|
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
if (vap->iv_ifflags & IFF_PROMISC)
|
|
|
|
ieee80211_promisc(vap, false);
|
|
|
|
if (vap->iv_ifflags & IFF_ALLMULTI)
|
|
|
|
ieee80211_allmulti(vap, false);
|
2008-04-20 20:35:46 +00:00
|
|
|
IEEE80211_UNLOCK(ic);
|
|
|
|
|
|
|
|
ifmedia_removeall(&vap->iv_media);
|
|
|
|
|
2009-05-20 20:00:40 +00:00
|
|
|
ieee80211_radiotap_vdetach(vap);
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_regdomain_vdetach(vap);
|
|
|
|
ieee80211_scan_vdetach(vap);
|
2009-03-24 20:39:08 +00:00
|
|
|
#ifdef IEEE80211_SUPPORT_SUPERG
|
|
|
|
ieee80211_superg_vdetach(vap);
|
|
|
|
#endif
|
2017-01-13 06:53:56 +00:00
|
|
|
ieee80211_vht_vdetach(vap);
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_ht_vdetach(vap);
|
|
|
|
/* NB: must be before ieee80211_node_vdetach */
|
|
|
|
ieee80211_proto_vdetach(vap);
|
|
|
|
ieee80211_crypto_vdetach(vap);
|
|
|
|
ieee80211_power_vdetach(vap);
|
|
|
|
ieee80211_node_vdetach(vap);
|
|
|
|
ieee80211_sysctl_vdetach(vap);
|
2008-09-02 04:49:35 +00:00
|
|
|
|
|
|
|
if_free(ifp);
|
2012-10-26 16:56:55 +00:00
|
|
|
|
|
|
|
CURVNET_RESTORE();
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
* Count number of vaps in promisc, and issue promisc on
|
|
|
|
* parent respectively.
|
2008-04-20 20:35:46 +00:00
|
|
|
*/
|
|
|
|
void
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
ieee80211_promisc(struct ieee80211vap *vap, bool on)
|
2008-04-20 20:35:46 +00:00
|
|
|
{
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
Change KPI of how device drivers that provide wireless connectivity interact
with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to Olivier Cochard, gjb@, mmoll@,
op@ and lev@, who also participated in testing. Details here:
https://wiki.freebsd.org/projects/ifnet/net80211
Still, drivers: ndis, wtap, mwl, ipw, bwn, wi, upgt, uath were not
tested. Changes to mwl, ipw, bwn, wi, upgt are trivial and chances
of problems are low. The wtap wasn't compilable even before this change.
But the ndis driver is complex, and it is likely to be broken with this
commit. Help with testing and debugging it is appreciated.
Differential Revision: D2655, D2740
Sponsored by: Nginx, Inc.
Sponsored by: Netflix
2015-08-07 11:43:14 +00:00
|
|
|
|
2016-02-28 23:48:34 +00:00
|
|
|
IEEE80211_LOCK_ASSERT(ic);
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
if (on) {
|
|
|
|
if (++ic->ic_promisc == 1)
|
|
|
|
ieee80211_runtask(ic, &ic->ic_promisc_task);
|
|
|
|
} else {
|
|
|
|
KASSERT(ic->ic_promisc > 0, ("%s: ic %p not promisc",
|
|
|
|
__func__, ic));
|
|
|
|
if (--ic->ic_promisc == 0)
|
|
|
|
ieee80211_runtask(ic, &ic->ic_promisc_task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Count number of vaps in allmulti, and issue allmulti on
|
|
|
|
* parent respectively.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ieee80211_allmulti(struct ieee80211vap *vap, bool on)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
|
2016-02-28 23:48:34 +00:00
|
|
|
IEEE80211_LOCK_ASSERT(ic);
|
|
|
|
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
if (on) {
|
|
|
|
if (++ic->ic_allmulti == 1)
|
|
|
|
ieee80211_runtask(ic, &ic->ic_mcast_task);
|
|
|
|
} else {
|
|
|
|
KASSERT(ic->ic_allmulti > 0, ("%s: ic %p not allmulti",
|
|
|
|
__func__, ic));
|
|
|
|
if (--ic->ic_allmulti == 0)
|
|
|
|
ieee80211_runtask(ic, &ic->ic_mcast_task);
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Synchronize flag bit state in the com structure
|
|
|
|
* according to the state of all vap's. This is used,
|
|
|
|
* for example, to handle state changes via ioctls.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ieee80211_syncflag_locked(struct ieee80211com *ic, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211vap *vap;
|
|
|
|
int bit;
|
|
|
|
|
|
|
|
IEEE80211_LOCK_ASSERT(ic);
|
|
|
|
|
|
|
|
bit = 0;
|
|
|
|
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
|
|
|
|
if (vap->iv_flags & flag) {
|
|
|
|
bit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bit)
|
|
|
|
ic->ic_flags |= flag;
|
|
|
|
else
|
|
|
|
ic->ic_flags &= ~flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ieee80211_syncflag(struct ieee80211vap *vap, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
|
|
|
|
IEEE80211_LOCK(ic);
|
|
|
|
if (flag < 0) {
|
|
|
|
flag = -flag;
|
|
|
|
vap->iv_flags &= ~flag;
|
|
|
|
} else
|
|
|
|
vap->iv_flags |= flag;
|
|
|
|
ieee80211_syncflag_locked(ic, flag);
|
|
|
|
IEEE80211_UNLOCK(ic);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2009-06-07 22:00:22 +00:00
|
|
|
* Synchronize flags_ht bit state in the com structure
|
|
|
|
* according to the state of all vap's. This is used,
|
|
|
|
* for example, to handle state changes via ioctls.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ieee80211_syncflag_ht_locked(struct ieee80211com *ic, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211vap *vap;
|
|
|
|
int bit;
|
|
|
|
|
|
|
|
IEEE80211_LOCK_ASSERT(ic);
|
|
|
|
|
|
|
|
bit = 0;
|
|
|
|
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
|
|
|
|
if (vap->iv_flags_ht & flag) {
|
|
|
|
bit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bit)
|
|
|
|
ic->ic_flags_ht |= flag;
|
|
|
|
else
|
|
|
|
ic->ic_flags_ht &= ~flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ieee80211_syncflag_ht(struct ieee80211vap *vap, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
|
|
|
|
IEEE80211_LOCK(ic);
|
|
|
|
if (flag < 0) {
|
|
|
|
flag = -flag;
|
|
|
|
vap->iv_flags_ht &= ~flag;
|
|
|
|
} else
|
|
|
|
vap->iv_flags_ht |= flag;
|
|
|
|
ieee80211_syncflag_ht_locked(ic, flag);
|
|
|
|
IEEE80211_UNLOCK(ic);
|
|
|
|
}
|
|
|
|
|
2017-01-07 07:35:27 +00:00
|
|
|
/*
|
|
|
|
* Synchronize flags_vht bit state in the com structure
|
|
|
|
* according to the state of all vap's. This is used,
|
|
|
|
* for example, to handle state changes via ioctls.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ieee80211_syncflag_vht_locked(struct ieee80211com *ic, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211vap *vap;
|
|
|
|
int bit;
|
|
|
|
|
|
|
|
IEEE80211_LOCK_ASSERT(ic);
|
|
|
|
|
|
|
|
bit = 0;
|
|
|
|
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
|
|
|
|
if (vap->iv_flags_vht & flag) {
|
|
|
|
bit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bit)
|
|
|
|
ic->ic_flags_vht |= flag;
|
|
|
|
else
|
|
|
|
ic->ic_flags_vht &= ~flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ieee80211_syncflag_vht(struct ieee80211vap *vap, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
|
|
|
|
IEEE80211_LOCK(ic);
|
|
|
|
if (flag < 0) {
|
|
|
|
flag = -flag;
|
|
|
|
vap->iv_flags_vht &= ~flag;
|
|
|
|
} else
|
|
|
|
vap->iv_flags_vht |= flag;
|
|
|
|
ieee80211_syncflag_vht_locked(ic, flag);
|
|
|
|
IEEE80211_UNLOCK(ic);
|
|
|
|
}
|
|
|
|
|
2009-06-07 22:00:22 +00:00
|
|
|
/*
|
|
|
|
* Synchronize flags_ext bit state in the com structure
|
2008-04-20 20:35:46 +00:00
|
|
|
* according to the state of all vap's. This is used,
|
|
|
|
* for example, to handle state changes via ioctls.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211vap *vap;
|
|
|
|
int bit;
|
|
|
|
|
|
|
|
IEEE80211_LOCK_ASSERT(ic);
|
|
|
|
|
|
|
|
bit = 0;
|
|
|
|
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
|
|
|
|
if (vap->iv_flags_ext & flag) {
|
|
|
|
bit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bit)
|
|
|
|
ic->ic_flags_ext |= flag;
|
|
|
|
else
|
|
|
|
ic->ic_flags_ext &= ~flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ieee80211_syncflag_ext(struct ieee80211vap *vap, int flag)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
|
|
|
|
IEEE80211_LOCK(ic);
|
|
|
|
if (flag < 0) {
|
|
|
|
flag = -flag;
|
|
|
|
vap->iv_flags_ext &= ~flag;
|
|
|
|
} else
|
|
|
|
vap->iv_flags_ext |= flag;
|
|
|
|
ieee80211_syncflag_ext_locked(ic, flag);
|
|
|
|
IEEE80211_UNLOCK(ic);
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
2007-01-15 01:12:28 +00:00
|
|
|
static __inline int
|
|
|
|
mapgsm(u_int freq, u_int flags)
|
|
|
|
{
|
|
|
|
freq *= 10;
|
|
|
|
if (flags & IEEE80211_CHAN_QUARTER)
|
|
|
|
freq += 5;
|
|
|
|
else if (flags & IEEE80211_CHAN_HALF)
|
|
|
|
freq += 10;
|
|
|
|
else
|
|
|
|
freq += 20;
|
|
|
|
/* NB: there is no 907/20 wide but leave room */
|
|
|
|
return (freq - 906*10) / 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline int
|
|
|
|
mappsb(u_int freq, u_int flags)
|
|
|
|
{
|
|
|
|
return 37 + ((freq * 10) + ((freq % 5) == 2 ? 5 : 0) - 49400) / 5;
|
|
|
|
}
|
|
|
|
|
2003-06-23 16:55:01 +00:00
|
|
|
/*
|
|
|
|
* Convert MHz frequency to IEEE channel number.
|
|
|
|
*/
|
2005-11-15 05:56:32 +00:00
|
|
|
int
|
2003-06-23 16:55:01 +00:00
|
|
|
ieee80211_mhz2ieee(u_int freq, u_int flags)
|
|
|
|
{
|
2007-03-11 06:24:26 +00:00
|
|
|
#define IS_FREQ_IN_PSB(_freq) ((_freq) > 4940 && (_freq) < 4990)
|
2007-01-15 01:12:28 +00:00
|
|
|
if (flags & IEEE80211_CHAN_GSM)
|
|
|
|
return mapgsm(freq, flags);
|
2003-06-23 16:55:01 +00:00
|
|
|
if (flags & IEEE80211_CHAN_2GHZ) { /* 2GHz band */
|
|
|
|
if (freq == 2484)
|
|
|
|
return 14;
|
|
|
|
if (freq < 2484)
|
2005-11-15 05:56:32 +00:00
|
|
|
return ((int) freq - 2407) / 5;
|
2003-06-23 16:55:01 +00:00
|
|
|
else
|
|
|
|
return 15 + ((freq - 2512) / 20);
|
2003-06-27 02:53:00 +00:00
|
|
|
} else if (flags & IEEE80211_CHAN_5GHZ) { /* 5Ghz band */
|
2006-12-27 18:46:18 +00:00
|
|
|
if (freq <= 5000) {
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/* XXX check regdomain? */
|
2007-03-11 06:24:26 +00:00
|
|
|
if (IS_FREQ_IN_PSB(freq))
|
2007-01-15 01:12:28 +00:00
|
|
|
return mappsb(freq, flags);
|
2005-11-15 05:56:32 +00:00
|
|
|
return (freq - 4000) / 5;
|
2006-12-27 18:46:18 +00:00
|
|
|
} else
|
2005-11-15 05:56:32 +00:00
|
|
|
return (freq - 5000) / 5;
|
2003-06-23 16:55:01 +00:00
|
|
|
} else { /* either, guess */
|
|
|
|
if (freq == 2484)
|
|
|
|
return 14;
|
2007-01-15 01:12:28 +00:00
|
|
|
if (freq < 2484) {
|
|
|
|
if (907 <= freq && freq <= 922)
|
|
|
|
return mapgsm(freq, flags);
|
2005-11-15 05:56:32 +00:00
|
|
|
return ((int) freq - 2407) / 5;
|
2007-01-15 01:12:28 +00:00
|
|
|
}
|
2005-11-15 05:56:32 +00:00
|
|
|
if (freq < 5000) {
|
2007-03-11 06:24:26 +00:00
|
|
|
if (IS_FREQ_IN_PSB(freq))
|
2007-01-15 01:12:28 +00:00
|
|
|
return mappsb(freq, flags);
|
2006-12-27 18:46:18 +00:00
|
|
|
else if (freq > 4900)
|
2005-11-15 05:56:32 +00:00
|
|
|
return (freq - 4000) / 5;
|
|
|
|
else
|
|
|
|
return 15 + ((freq - 2512) / 20);
|
|
|
|
}
|
2003-06-23 16:55:01 +00:00
|
|
|
return (freq - 5000) / 5;
|
|
|
|
}
|
2007-03-11 06:24:26 +00:00
|
|
|
#undef IS_FREQ_IN_PSB
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert channel to IEEE channel number.
|
|
|
|
*/
|
2005-11-15 05:56:32 +00:00
|
|
|
int
|
2007-01-06 05:38:18 +00:00
|
|
|
ieee80211_chan2ieee(struct ieee80211com *ic, const struct ieee80211_channel *c)
|
2003-06-23 16:55:01 +00:00
|
|
|
{
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
if (c == NULL) {
|
2015-05-25 14:30:44 +00:00
|
|
|
ic_printf(ic, "invalid channel (NULL)\n");
|
2003-06-29 20:10:54 +00:00
|
|
|
return 0; /* XXX */
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
return (c == IEEE80211_CHAN_ANYC ? IEEE80211_CHAN_ANY : c->ic_ieee);
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert IEEE channel number to MHz frequency.
|
|
|
|
*/
|
|
|
|
u_int
|
|
|
|
ieee80211_ieee2mhz(u_int chan, u_int flags)
|
|
|
|
{
|
2007-01-15 01:12:28 +00:00
|
|
|
if (flags & IEEE80211_CHAN_GSM)
|
|
|
|
return 907 + 5 * (chan / 10);
|
2003-06-23 16:55:01 +00:00
|
|
|
if (flags & IEEE80211_CHAN_2GHZ) { /* 2GHz band */
|
|
|
|
if (chan == 14)
|
|
|
|
return 2484;
|
|
|
|
if (chan < 14)
|
|
|
|
return 2407 + chan*5;
|
|
|
|
else
|
|
|
|
return 2512 + ((chan-15)*20);
|
|
|
|
} else if (flags & IEEE80211_CHAN_5GHZ) {/* 5Ghz band */
|
2006-12-27 18:46:18 +00:00
|
|
|
if (flags & (IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER)) {
|
|
|
|
chan -= 37;
|
|
|
|
return 4940 + chan*5 + (chan % 5 ? 2 : 0);
|
|
|
|
}
|
2003-06-23 16:55:01 +00:00
|
|
|
return 5000 + (chan*5);
|
|
|
|
} else { /* either, guess */
|
2007-01-15 01:12:28 +00:00
|
|
|
/* XXX can't distinguish PSB+GSM channels */
|
2003-06-23 16:55:01 +00:00
|
|
|
if (chan == 14)
|
|
|
|
return 2484;
|
|
|
|
if (chan < 14) /* 0-13 */
|
|
|
|
return 2407 + chan*5;
|
|
|
|
if (chan < 27) /* 15-26 */
|
|
|
|
return 2512 + ((chan-15)*20);
|
|
|
|
return 5000 + (chan*5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
static __inline void
|
|
|
|
set_extchan(struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IEEE Std 802.11-2012, page 1738, subclause 20.3.15.4:
|
|
|
|
* "the secondary channel number shall be 'N + [1,-1] * 4'
|
|
|
|
*/
|
|
|
|
if (c->ic_flags & IEEE80211_CHAN_HT40U)
|
|
|
|
c->ic_extieee = c->ic_ieee + 4;
|
|
|
|
else if (c->ic_flags & IEEE80211_CHAN_HT40D)
|
|
|
|
c->ic_extieee = c->ic_ieee - 4;
|
|
|
|
else
|
|
|
|
c->ic_extieee = 0;
|
|
|
|
}
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* Populate the freq1/freq2 fields as appropriate for VHT channels.
|
|
|
|
*
|
|
|
|
* This for now uses a hard-coded list of 80MHz wide channels.
|
|
|
|
*
|
|
|
|
* For HT20/HT40, freq1 just is the centre frequency of the 40MHz
|
|
|
|
* wide channel we've already decided upon.
|
|
|
|
*
|
|
|
|
* For VHT80 and VHT160, there are only a small number of fixed
|
|
|
|
* 80/160MHz wide channels, so we just use those.
|
|
|
|
*
|
|
|
|
* This is all likely very very wrong - both the regulatory code
|
|
|
|
* and this code needs to ensure that all four channels are
|
|
|
|
* available and valid before the VHT80 (and eight for VHT160) channel
|
|
|
|
* is created.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct vht_chan_range {
|
|
|
|
uint16_t freq_start;
|
|
|
|
uint16_t freq_end;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vht_chan_range vht80_chan_ranges[] = {
|
|
|
|
{ 5170, 5250 },
|
|
|
|
{ 5250, 5330 },
|
|
|
|
{ 5490, 5570 },
|
|
|
|
{ 5570, 5650 },
|
|
|
|
{ 5650, 5730 },
|
|
|
|
{ 5735, 5815 },
|
2020-10-07 21:56:58 +00:00
|
|
|
{ 0, 0 }
|
2017-01-13 06:53:56 +00:00
|
|
|
};
|
|
|
|
|
2020-10-18 00:27:20 +00:00
|
|
|
struct vht_chan_range vht160_chan_ranges[] = {
|
|
|
|
{ 5170, 5330 },
|
|
|
|
{ 5490, 5650 },
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
static int
|
|
|
|
set_vht_extchan(struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2020-08-23 21:37:20 +00:00
|
|
|
if (! IEEE80211_IS_CHAN_VHT(c))
|
2017-01-13 06:53:56 +00:00
|
|
|
return (0);
|
|
|
|
|
2020-08-23 21:37:20 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT80P80(c)) {
|
|
|
|
printf("%s: TODO VHT80+80 channel (ieee=%d, flags=0x%08x)\n",
|
|
|
|
__func__, c->ic_ieee, c->ic_flags);
|
2017-01-13 06:53:56 +00:00
|
|
|
}
|
|
|
|
|
2020-08-23 21:37:20 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT160(c)) {
|
2020-10-18 00:27:20 +00:00
|
|
|
for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) {
|
|
|
|
if (c->ic_freq >= vht160_chan_ranges[i].freq_start &&
|
|
|
|
c->ic_freq < vht160_chan_ranges[i].freq_end) {
|
|
|
|
int midpoint;
|
|
|
|
|
|
|
|
midpoint = vht160_chan_ranges[i].freq_start + 80;
|
|
|
|
c->ic_vht_ch_freq1 =
|
|
|
|
ieee80211_mhz2ieee(midpoint, c->ic_flags);
|
|
|
|
c->ic_vht_ch_freq2 = 0;
|
|
|
|
#if 0
|
|
|
|
printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n",
|
|
|
|
__func__, c->ic_ieee, c->ic_freq, midpoint,
|
|
|
|
c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
|
|
|
|
#endif
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
2017-01-13 06:53:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (IEEE80211_IS_CHAN_VHT80(c)) {
|
|
|
|
for (i = 0; vht80_chan_ranges[i].freq_start != 0; i++) {
|
|
|
|
if (c->ic_freq >= vht80_chan_ranges[i].freq_start &&
|
|
|
|
c->ic_freq < vht80_chan_ranges[i].freq_end) {
|
|
|
|
int midpoint;
|
|
|
|
|
|
|
|
midpoint = vht80_chan_ranges[i].freq_start + 40;
|
|
|
|
c->ic_vht_ch_freq1 =
|
|
|
|
ieee80211_mhz2ieee(midpoint, c->ic_flags);
|
|
|
|
c->ic_vht_ch_freq2 = 0;
|
|
|
|
#if 0
|
|
|
|
printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n",
|
|
|
|
__func__, c->ic_ieee, c->ic_freq, midpoint,
|
|
|
|
c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
|
|
|
|
#endif
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2020-08-23 21:37:20 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT40(c)) {
|
|
|
|
if (IEEE80211_IS_CHAN_HT40U(c))
|
|
|
|
c->ic_vht_ch_freq1 = c->ic_ieee + 2;
|
|
|
|
else if (IEEE80211_IS_CHAN_HT40D(c))
|
|
|
|
c->ic_vht_ch_freq1 = c->ic_ieee - 2;
|
|
|
|
else
|
|
|
|
return (0);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IEEE80211_IS_CHAN_VHT20(c)) {
|
|
|
|
c->ic_vht_ch_freq1 = c->ic_ieee;
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n",
|
2020-08-17 16:28:59 +00:00
|
|
|
__func__, c->ic_ieee, c->ic_flags);
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return whether the current channel could possibly be a part of
|
2020-10-18 00:27:20 +00:00
|
|
|
* a VHT80/VHT160 channel.
|
2017-01-13 06:53:56 +00:00
|
|
|
*
|
|
|
|
* This doesn't check that the whole range is in the allowed list
|
|
|
|
* according to regulatory.
|
|
|
|
*/
|
2020-10-18 00:27:20 +00:00
|
|
|
static bool
|
|
|
|
is_vht160_valid_freq(uint16_t freq)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) {
|
|
|
|
if (freq >= vht160_chan_ranges[i].freq_start &&
|
|
|
|
freq < vht160_chan_ranges[i].freq_end)
|
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
return (false);
|
|
|
|
}
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
static int
|
|
|
|
is_vht80_valid_freq(uint16_t freq)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; vht80_chan_ranges[i].freq_start != 0; i++) {
|
|
|
|
if (freq >= vht80_chan_ranges[i].freq_start &&
|
|
|
|
freq < vht80_chan_ranges[i].freq_end)
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
static int
|
|
|
|
addchan(struct ieee80211_channel chans[], int maxchans, int *nchans,
|
|
|
|
uint8_t ieee, uint16_t freq, int8_t maxregpower, uint32_t flags)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *c;
|
|
|
|
|
|
|
|
if (*nchans >= maxchans)
|
|
|
|
return (ENOBUFS);
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
#if 0
|
2022-02-14 22:16:59 +00:00
|
|
|
printf("%s: %d of %d: ieee=%d, freq=%d, flags=0x%08x\n",
|
|
|
|
__func__, *nchans, maxchans, ieee, freq, flags);
|
2017-01-13 06:53:56 +00:00
|
|
|
#endif
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
c = &chans[(*nchans)++];
|
|
|
|
c->ic_ieee = ieee;
|
|
|
|
c->ic_freq = freq != 0 ? freq : ieee80211_ieee2mhz(ieee, flags);
|
|
|
|
c->ic_maxregpower = maxregpower;
|
|
|
|
c->ic_maxpower = 2 * maxregpower;
|
|
|
|
c->ic_flags = flags;
|
2017-01-13 06:53:56 +00:00
|
|
|
c->ic_vht_ch_freq1 = 0;
|
|
|
|
c->ic_vht_ch_freq2 = 0;
|
2016-04-29 21:18:14 +00:00
|
|
|
set_extchan(c);
|
2017-01-13 06:53:56 +00:00
|
|
|
set_vht_extchan(c);
|
2016-04-29 21:18:14 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
copychan_prev(struct ieee80211_channel chans[], int maxchans, int *nchans,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *c;
|
|
|
|
|
|
|
|
KASSERT(*nchans > 0, ("channel list is empty\n"));
|
|
|
|
|
|
|
|
if (*nchans >= maxchans)
|
|
|
|
return (ENOBUFS);
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
#if 0
|
2022-02-14 22:16:59 +00:00
|
|
|
printf("%s: %d of %d: flags=0x%08x\n",
|
|
|
|
__func__, *nchans, maxchans, flags);
|
2017-01-13 06:53:56 +00:00
|
|
|
#endif
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
c = &chans[(*nchans)++];
|
|
|
|
c[0] = c[-1];
|
|
|
|
c->ic_flags = flags;
|
2017-01-13 06:53:56 +00:00
|
|
|
c->ic_vht_ch_freq1 = 0;
|
|
|
|
c->ic_vht_ch_freq2 = 0;
|
2016-04-29 21:18:14 +00:00
|
|
|
set_extchan(c);
|
2017-01-13 06:53:56 +00:00
|
|
|
set_vht_extchan(c);
|
2016-04-29 21:18:14 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* XXX VHT-2GHz
|
|
|
|
*/
|
2016-04-29 21:18:14 +00:00
|
|
|
static void
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags_2ghz(const uint8_t bands[], uint32_t flags[], int cbw_flags)
|
2016-04-29 21:18:14 +00:00
|
|
|
{
|
|
|
|
int nmodes;
|
|
|
|
|
|
|
|
nmodes = 0;
|
|
|
|
if (isset(bands, IEEE80211_MODE_11B))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_B;
|
|
|
|
if (isset(bands, IEEE80211_MODE_11G))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_G;
|
|
|
|
if (isset(bands, IEEE80211_MODE_11NG))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT20;
|
2020-08-24 13:15:08 +00:00
|
|
|
if (cbw_flags & NET80211_CBW_FLAG_HT40) {
|
2016-04-29 21:18:14 +00:00
|
|
|
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U;
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D;
|
|
|
|
}
|
|
|
|
flags[nmodes] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags_5ghz(const uint8_t bands[], uint32_t flags[], int cbw_flags)
|
2016-04-29 21:18:14 +00:00
|
|
|
{
|
|
|
|
int nmodes;
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
2020-08-24 13:15:08 +00:00
|
|
|
* The addchan_list() function seems to expect the flags array to
|
2017-01-13 06:53:56 +00:00
|
|
|
* be in channel width order, so the VHT bits are interspersed
|
|
|
|
* as appropriate to maintain said order.
|
|
|
|
*
|
|
|
|
* It also assumes HT40U is before HT40D.
|
|
|
|
*/
|
2016-04-29 21:18:14 +00:00
|
|
|
nmodes = 0;
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
/* 20MHz */
|
2016-04-29 21:18:14 +00:00
|
|
|
if (isset(bands, IEEE80211_MODE_11A))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A;
|
|
|
|
if (isset(bands, IEEE80211_MODE_11NA))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20;
|
2017-01-13 06:53:56 +00:00
|
|
|
if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 |
|
|
|
|
IEEE80211_CHAN_VHT20;
|
2017-01-22 23:45:59 +00:00
|
|
|
}
|
2017-01-13 06:53:56 +00:00
|
|
|
|
|
|
|
/* 40MHz */
|
2020-08-24 13:15:08 +00:00
|
|
|
if (cbw_flags & NET80211_CBW_FLAG_HT40)
|
2016-04-29 21:18:14 +00:00
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U;
|
2020-08-24 13:15:08 +00:00
|
|
|
if ((cbw_flags & NET80211_CBW_FLAG_HT40) &&
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_5GHZ))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
|
|
|
|
IEEE80211_CHAN_VHT40U;
|
|
|
|
if (cbw_flags & NET80211_CBW_FLAG_HT40)
|
2016-04-29 21:18:14 +00:00
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D;
|
2020-08-24 13:15:08 +00:00
|
|
|
if ((cbw_flags & NET80211_CBW_FLAG_HT40) &&
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_5GHZ))
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
|
|
|
|
IEEE80211_CHAN_VHT40D;
|
|
|
|
|
|
|
|
/* 80MHz */
|
|
|
|
if ((cbw_flags & NET80211_CBW_FLAG_VHT80) &&
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
|
|
|
|
IEEE80211_CHAN_VHT80;
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
|
|
|
|
IEEE80211_CHAN_VHT80;
|
2016-04-29 21:18:14 +00:00
|
|
|
}
|
2020-08-24 13:15:08 +00:00
|
|
|
|
|
|
|
/* VHT160 */
|
|
|
|
if ((cbw_flags & NET80211_CBW_FLAG_VHT160) &&
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
|
|
|
|
IEEE80211_CHAN_VHT160;
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
|
|
|
|
IEEE80211_CHAN_VHT160;
|
2017-01-13 06:53:56 +00:00
|
|
|
}
|
|
|
|
|
2020-08-24 13:15:08 +00:00
|
|
|
/* VHT80+80 */
|
|
|
|
if ((cbw_flags & NET80211_CBW_FLAG_VHT80P80) &&
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
|
|
|
|
IEEE80211_CHAN_VHT80P80;
|
|
|
|
flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
|
|
|
|
IEEE80211_CHAN_VHT80P80;
|
2017-01-13 06:53:56 +00:00
|
|
|
}
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
flags[nmodes] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags(const uint8_t bands[], uint32_t flags[], int cbw_flags)
|
2016-04-29 21:18:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
flags[0] = 0;
|
|
|
|
if (isset(bands, IEEE80211_MODE_11A) ||
|
2017-01-13 06:53:56 +00:00
|
|
|
isset(bands, IEEE80211_MODE_11NA) ||
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_5GHZ)) {
|
2016-04-29 21:18:14 +00:00
|
|
|
if (isset(bands, IEEE80211_MODE_11B) ||
|
|
|
|
isset(bands, IEEE80211_MODE_11G) ||
|
2017-01-13 06:53:56 +00:00
|
|
|
isset(bands, IEEE80211_MODE_11NG) ||
|
|
|
|
isset(bands, IEEE80211_MODE_VHT_2GHZ))
|
2016-04-29 21:18:14 +00:00
|
|
|
return;
|
|
|
|
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags_5ghz(bands, flags, cbw_flags);
|
2016-04-29 21:18:14 +00:00
|
|
|
} else
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags_2ghz(bands, flags, cbw_flags);
|
2016-04-29 21:18:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add one 20 MHz channel into specified channel list.
|
2019-06-10 14:31:18 +00:00
|
|
|
* You MUST NOT mix bands when calling this. It will not add 5ghz
|
|
|
|
* channels if you have any B/G/N band bit set.
|
2020-10-18 00:27:20 +00:00
|
|
|
* The _cbw() variant does also support HT40/VHT80/160/80+80.
|
2016-04-29 21:18:14 +00:00
|
|
|
*/
|
|
|
|
int
|
2020-10-18 00:27:20 +00:00
|
|
|
ieee80211_add_channel_cbw(struct ieee80211_channel chans[], int maxchans,
|
2016-04-29 21:18:14 +00:00
|
|
|
int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower,
|
2020-10-18 00:27:20 +00:00
|
|
|
uint32_t chan_flags, const uint8_t bands[], int cbw_flags)
|
2016-04-29 21:18:14 +00:00
|
|
|
{
|
|
|
|
uint32_t flags[IEEE80211_MODE_MAX];
|
|
|
|
int i, error;
|
|
|
|
|
2020-10-18 00:27:20 +00:00
|
|
|
getflags(bands, flags, cbw_flags);
|
2016-04-29 21:18:14 +00:00
|
|
|
KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
|
|
|
|
|
|
|
|
error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower,
|
|
|
|
flags[0] | chan_flags);
|
|
|
|
for (i = 1; flags[i] != 0 && error == 0; i++) {
|
|
|
|
error = copychan_prev(chans, maxchans, nchans,
|
|
|
|
flags[i] | chan_flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
2020-10-18 00:27:20 +00:00
|
|
|
int
|
|
|
|
ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans,
|
|
|
|
int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower,
|
|
|
|
uint32_t chan_flags, const uint8_t bands[])
|
|
|
|
{
|
|
|
|
|
|
|
|
return (ieee80211_add_channel_cbw(chans, maxchans, nchans, ieee, freq,
|
|
|
|
maxregpower, chan_flags, bands, 0));
|
|
|
|
}
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
static struct ieee80211_channel *
|
|
|
|
findchannel(struct ieee80211_channel chans[], int nchans, uint16_t freq,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *c;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
flags &= IEEE80211_CHAN_ALLTURBO;
|
|
|
|
/* brute force search */
|
|
|
|
for (i = 0; i < nchans; i++) {
|
|
|
|
c = &chans[i];
|
|
|
|
if (c->ic_freq == freq &&
|
|
|
|
(c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add 40 MHz channel pair into specified channel list.
|
|
|
|
*/
|
2017-01-13 06:53:56 +00:00
|
|
|
/* XXX VHT */
|
2016-04-29 21:18:14 +00:00
|
|
|
int
|
|
|
|
ieee80211_add_channel_ht40(struct ieee80211_channel chans[], int maxchans,
|
|
|
|
int *nchans, uint8_t ieee, int8_t maxregpower, uint32_t flags)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *cent, *extc;
|
|
|
|
uint16_t freq;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
freq = ieee80211_ieee2mhz(ieee, flags);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Each entry defines an HT40 channel pair; find the
|
|
|
|
* center channel, then the extension channel above.
|
|
|
|
*/
|
|
|
|
flags |= IEEE80211_CHAN_HT20;
|
|
|
|
cent = findchannel(chans, *nchans, freq, flags);
|
|
|
|
if (cent == NULL)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
extc = findchannel(chans, *nchans, freq + 20, flags);
|
|
|
|
if (extc == NULL)
|
|
|
|
return (ENOENT);
|
|
|
|
|
|
|
|
flags &= ~IEEE80211_CHAN_HT;
|
|
|
|
error = addchan(chans, maxchans, nchans, cent->ic_ieee, cent->ic_freq,
|
|
|
|
maxregpower, flags | IEEE80211_CHAN_HT40U);
|
|
|
|
if (error != 0)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
error = addchan(chans, maxchans, nchans, extc->ic_ieee, extc->ic_freq,
|
|
|
|
maxregpower, flags | IEEE80211_CHAN_HT40D);
|
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
2016-12-03 02:45:18 +00:00
|
|
|
/*
|
|
|
|
* Fetch the center frequency for the primary channel.
|
|
|
|
*/
|
|
|
|
uint32_t
|
|
|
|
ieee80211_get_channel_center_freq(const struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
|
|
|
|
return (c->ic_freq);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fetch the center frequency for the primary BAND channel.
|
|
|
|
*
|
|
|
|
* For 5, 10, 20MHz channels it'll be the normally configured channel
|
|
|
|
* frequency.
|
|
|
|
*
|
2022-09-07 11:13:54 +00:00
|
|
|
* For 40MHz, 80MHz, 160MHz channels it will be the centre of the
|
2016-12-03 02:45:18 +00:00
|
|
|
* wide channel, not the centre of the primary channel (that's ic_freq).
|
|
|
|
*
|
|
|
|
* For 80+80MHz channels this will be the centre of the primary
|
|
|
|
* 80MHz channel; the secondary 80MHz channel will be center_freq2().
|
|
|
|
*/
|
|
|
|
uint32_t
|
|
|
|
ieee80211_get_channel_center_freq1(const struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* VHT - use the pre-calculated centre frequency
|
|
|
|
* of the given channel.
|
|
|
|
*/
|
|
|
|
if (IEEE80211_IS_CHAN_VHT(c))
|
|
|
|
return (ieee80211_ieee2mhz(c->ic_vht_ch_freq1, c->ic_flags));
|
|
|
|
|
2016-12-03 02:45:18 +00:00
|
|
|
if (IEEE80211_IS_CHAN_HT40U(c)) {
|
|
|
|
return (c->ic_freq + 10);
|
|
|
|
}
|
|
|
|
if (IEEE80211_IS_CHAN_HT40D(c)) {
|
|
|
|
return (c->ic_freq - 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (c->ic_freq);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2017-01-13 06:53:56 +00:00
|
|
|
* For now, no 80+80 support; it will likely always return 0.
|
2016-12-03 02:45:18 +00:00
|
|
|
*/
|
|
|
|
uint32_t
|
|
|
|
ieee80211_get_channel_center_freq2(const struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT(c) && (c->ic_vht_ch_freq2 != 0))
|
|
|
|
return (ieee80211_ieee2mhz(c->ic_vht_ch_freq2, c->ic_flags));
|
|
|
|
|
2016-12-03 02:45:18 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
/*
|
|
|
|
* Adds channels into specified channel list (ieee[] array must be sorted).
|
|
|
|
* Channels are already sorted.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
add_chanlist(struct ieee80211_channel chans[], int maxchans, int *nchans,
|
|
|
|
const uint8_t ieee[], int nieee, uint32_t flags[])
|
|
|
|
{
|
|
|
|
uint16_t freq;
|
|
|
|
int i, j, error;
|
2017-01-13 06:53:56 +00:00
|
|
|
int is_vht;
|
2016-04-29 21:18:14 +00:00
|
|
|
|
|
|
|
for (i = 0; i < nieee; i++) {
|
|
|
|
freq = ieee80211_ieee2mhz(ieee[i], flags[0]);
|
|
|
|
for (j = 0; flags[j] != 0; j++) {
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* Notes:
|
|
|
|
* + HT40 and VHT40 channels occur together, so
|
|
|
|
* we need to be careful that we actually allow that.
|
|
|
|
* + VHT80, VHT160 will coexist with HT40/VHT40, so
|
|
|
|
* make sure it's not skipped because of the overlap
|
|
|
|
* check used for (V)HT40.
|
|
|
|
*/
|
|
|
|
is_vht = !! (flags[j] & IEEE80211_CHAN_VHT);
|
|
|
|
|
2020-08-17 13:04:18 +00:00
|
|
|
/* XXX TODO FIXME VHT80P80. */
|
2020-10-18 00:27:20 +00:00
|
|
|
|
|
|
|
/* Test for VHT160 analogue to the VHT80 below. */
|
|
|
|
if (is_vht && flags[j] & IEEE80211_CHAN_VHT160)
|
|
|
|
if (! is_vht160_valid_freq(freq))
|
|
|
|
continue;
|
2020-08-17 13:04:18 +00:00
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* Test for VHT80.
|
|
|
|
* XXX This is all very broken right now.
|
|
|
|
* What we /should/ do is:
|
|
|
|
*
|
|
|
|
* + check that the frequency is in the list of
|
|
|
|
* allowed VHT80 ranges; and
|
|
|
|
* + the other 3 channels in the list are actually
|
|
|
|
* also available.
|
|
|
|
*/
|
|
|
|
if (is_vht && flags[j] & IEEE80211_CHAN_VHT80)
|
|
|
|
if (! is_vht80_valid_freq(freq))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Test for (V)HT40.
|
|
|
|
*
|
|
|
|
* This is also a fall through from VHT80; as we only
|
|
|
|
* allow a VHT80 channel if the VHT40 combination is
|
|
|
|
* also valid. If the VHT40 form is not valid then
|
|
|
|
* we certainly can't do VHT80..
|
|
|
|
*/
|
2016-04-29 21:18:14 +00:00
|
|
|
if (flags[j] & IEEE80211_CHAN_HT40D)
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* Can't have a "lower" channel if we are the
|
|
|
|
* first channel.
|
|
|
|
*
|
|
|
|
* Can't have a "lower" channel if it's below/
|
|
|
|
* within 20MHz of the first channel.
|
|
|
|
*
|
|
|
|
* Can't have a "lower" channel if the channel
|
|
|
|
* below it is not 20MHz away.
|
|
|
|
*/
|
2016-04-29 21:18:14 +00:00
|
|
|
if (i == 0 || ieee[i] < ieee[0] + 4 ||
|
|
|
|
freq - 20 !=
|
|
|
|
ieee80211_ieee2mhz(ieee[i] - 4, flags[j]))
|
|
|
|
continue;
|
|
|
|
if (flags[j] & IEEE80211_CHAN_HT40U)
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
|
|
|
* Can't have an "upper" channel if we are
|
|
|
|
* the last channel.
|
|
|
|
*
|
|
|
|
* Can't have an "upper" channel be above the
|
|
|
|
* last channel in the list.
|
|
|
|
*
|
|
|
|
* Can't have an "upper" channel if the next
|
|
|
|
* channel according to the math isn't 20MHz
|
|
|
|
* away. (Likely for channel 13/14.)
|
|
|
|
*/
|
2016-04-29 21:18:14 +00:00
|
|
|
if (i == nieee - 1 ||
|
|
|
|
ieee[i] + 4 > ieee[nieee - 1] ||
|
|
|
|
freq + 20 !=
|
|
|
|
ieee80211_ieee2mhz(ieee[i] + 4, flags[j]))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (j == 0) {
|
|
|
|
error = addchan(chans, maxchans, nchans,
|
|
|
|
ieee[i], freq, 0, flags[j]);
|
|
|
|
} else {
|
|
|
|
error = copychan_prev(chans, maxchans, nchans,
|
|
|
|
flags[j]);
|
|
|
|
}
|
|
|
|
if (error != 0)
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-19 21:08:33 +00:00
|
|
|
return (0);
|
2016-04-29 21:18:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ieee80211_add_channel_list_2ghz(struct ieee80211_channel chans[], int maxchans,
|
|
|
|
int *nchans, const uint8_t ieee[], int nieee, const uint8_t bands[],
|
2020-08-24 13:15:08 +00:00
|
|
|
int cbw_flags)
|
2016-04-29 21:18:14 +00:00
|
|
|
{
|
|
|
|
uint32_t flags[IEEE80211_MODE_MAX];
|
|
|
|
|
2017-01-13 06:53:56 +00:00
|
|
|
/* XXX no VHT for now */
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags_2ghz(bands, flags, cbw_flags);
|
2016-04-29 21:18:14 +00:00
|
|
|
KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
|
|
|
|
|
|
|
|
return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
|
|
|
|
}
|
|
|
|
|
2019-01-26 17:00:55 +00:00
|
|
|
int
|
|
|
|
ieee80211_add_channels_default_2ghz(struct ieee80211_channel chans[],
|
2020-08-24 13:15:08 +00:00
|
|
|
int maxchans, int *nchans, const uint8_t bands[], int cbw_flags)
|
2019-01-26 17:00:55 +00:00
|
|
|
{
|
|
|
|
const uint8_t default_chan_list[] =
|
|
|
|
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
|
|
|
|
|
|
|
|
return (ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
|
2020-08-24 13:15:08 +00:00
|
|
|
default_chan_list, nitems(default_chan_list), bands, cbw_flags));
|
2019-01-26 17:00:55 +00:00
|
|
|
}
|
|
|
|
|
2016-04-29 21:18:14 +00:00
|
|
|
int
|
|
|
|
ieee80211_add_channel_list_5ghz(struct ieee80211_channel chans[], int maxchans,
|
|
|
|
int *nchans, const uint8_t ieee[], int nieee, const uint8_t bands[],
|
2020-08-24 13:15:08 +00:00
|
|
|
int cbw_flags)
|
2016-04-29 21:18:14 +00:00
|
|
|
{
|
2017-01-13 06:53:56 +00:00
|
|
|
/*
|
2020-08-24 13:15:08 +00:00
|
|
|
* XXX-BZ with HT and VHT there is no 1:1 mapping anymore. Review all
|
|
|
|
* uses of IEEE80211_MODE_MAX and add a new #define name for array size.
|
2017-01-13 06:53:56 +00:00
|
|
|
*/
|
2020-08-24 13:15:08 +00:00
|
|
|
uint32_t flags[2 * IEEE80211_MODE_MAX];
|
2016-04-29 21:18:14 +00:00
|
|
|
|
2020-08-24 13:15:08 +00:00
|
|
|
getflags_5ghz(bands, flags, cbw_flags);
|
2016-04-29 21:18:14 +00:00
|
|
|
KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
|
|
|
|
|
|
|
|
return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
|
|
|
|
}
|
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/*
|
|
|
|
* Locate a channel given a frequency+flags. We cache
|
2008-04-20 20:35:46 +00:00
|
|
|
* the previous lookup to optimize switching between two
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
* channels--as happens with dynamic turbo.
|
|
|
|
*/
|
|
|
|
struct ieee80211_channel *
|
|
|
|
ieee80211_find_channel(struct ieee80211com *ic, int freq, int flags)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *c;
|
|
|
|
|
|
|
|
flags &= IEEE80211_CHAN_ALLTURBO;
|
|
|
|
c = ic->ic_prevchan;
|
|
|
|
if (c != NULL && c->ic_freq == freq &&
|
|
|
|
(c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
|
|
|
|
return c;
|
|
|
|
/* brute force search */
|
2016-04-29 21:18:14 +00:00
|
|
|
return (findchannel(ic->ic_channels, ic->ic_nchans, freq, flags));
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
}
|
|
|
|
|
2007-11-23 05:57:20 +00:00
|
|
|
/*
|
|
|
|
* Locate a channel given a channel number+flags. We cache
|
|
|
|
* the previous lookup to optimize switching between two
|
|
|
|
* channels--as happens with dynamic turbo.
|
|
|
|
*/
|
|
|
|
struct ieee80211_channel *
|
|
|
|
ieee80211_find_channel_byieee(struct ieee80211com *ic, int ieee, int flags)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *c;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
flags &= IEEE80211_CHAN_ALLTURBO;
|
|
|
|
c = ic->ic_prevchan;
|
|
|
|
if (c != NULL && c->ic_ieee == ieee &&
|
|
|
|
(c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
|
|
|
|
return c;
|
|
|
|
/* brute force search */
|
|
|
|
for (i = 0; i < ic->ic_nchans; i++) {
|
|
|
|
c = &ic->ic_channels[i];
|
|
|
|
if (c->ic_ieee == ieee &&
|
|
|
|
(c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
Begin plumbing ieee80211_rx_stats through the receive path.
Smart NICs with firmware (eg wpi, iwn, the new atheros parts, the intel 7260
series, etc) support doing a lot of things in firmware. This includes but
isn't limited to things like scanning, sending probe requests and receiving
probe responses. However, net80211 doesn't know about any of this - it still
drives the whole scan/probe infrastructure itself.
In order to move towards suppoting smart NICs, the receive path needs to
know about the channel/details for each received packet. In at least
the iwn and 7260 firmware (and I believe wpi, but I haven't tried it yet)
it will do the scanning, power-save and off-channel buffering for you -
all you need to do is handle receiving beacons and probe responses on
channels that aren't what you're currently on. However the whole receive
path is peppered with ic->ic_curchan and manual scan/powersave handling.
The beacon parsing code also checks ic->ic_curchan to determine if the
received beacon is on the correct channel or not.[1]
So:
* add freq/ieee values to ieee80211_rx_stats;
* change ieee80211_parse_beacon() to accept the 'current' channel
as an argument;
* modify the iv_input() and iv_recv_mgmt() methods to include the rx_stats;
* add a new method - ieee80211_lookup_channel_rxstats() - that looks up
a channel based on the contents of ieee80211_rx_stats;
* if it exists, use it in the mgmt path to switch the current channel
(which still defaults to ic->ic_curchan) over to something determined
by rx_stats.
This is enough to kick-start scan offload support in the Intel 7260
driver that Rui/I are working on. It also is a good start for scan
offload support for a handful of existing NICs (wpi, iwn, some USB
parts) and it'll very likely dramatically improve stability/performance
there. It's not the whole thing - notably, we don't need to do powersave,
we should not scan all channels, and we should leave probe request sending
to the firmware and not do it ourselves. But, this allows for continued
development on the above features whilst actually having a somewhat
working NIC.
TODO:
* Finish tidying up how the net80211 input path works.
Right now ieee80211_input / ieee80211_input_all act as the top-level
that everything feeds into; it should change so the MIMO input routines
are those and the legacy routines are phased out.
* The band selection should be done by the driver, not by the net80211
layer.
* ieee80211_lookup_channel_rxstats() only determines 11b or 11g channels
for now - this is enough for scanning, but not 100% true in all cases.
If we ever need to handle off-channel scan support for things like
static-40MHz or static-80MHz, or turbo-G, or half/quarter rates,
then we should extend this.
[1] This is a side effect of frequency-hopping and CCK modes - you
can receive beacons when you think you're on a different channel.
In particular, CCK (which is used by the low 11b rates, eg beacons!)
is decodable from adjacent channels - just at a low SNR.
FH is a side effect of having the hardware/firmware do the frequency
hopping - it may pick up beacons transmitted from other FH networks
that are in a different phase of hopping frequencies.
2015-05-25 16:37:41 +00:00
|
|
|
/*
|
|
|
|
* Lookup a channel suitable for the given rx status.
|
|
|
|
*
|
|
|
|
* This is used to find a channel for a frame (eg beacon, probe
|
|
|
|
* response) based purely on the received PHY information.
|
|
|
|
*
|
|
|
|
* For now it tries to do it based on R_FREQ / R_IEEE.
|
|
|
|
* This is enough for 11bg and 11a (and thus 11ng/11na)
|
|
|
|
* but it will not be enough for GSM, PSB channels and the
|
|
|
|
* like. It also doesn't know about legacy-turbog and
|
|
|
|
* legacy-turbo modes, which some offload NICs actually
|
|
|
|
* support in weird ways.
|
|
|
|
*
|
|
|
|
* Takes the ic and rxstatus; returns the channel or NULL
|
|
|
|
* if not found.
|
|
|
|
*
|
|
|
|
* XXX TODO: Add support for that when the need arises.
|
|
|
|
*/
|
|
|
|
struct ieee80211_channel *
|
|
|
|
ieee80211_lookup_channel_rxstatus(struct ieee80211vap *vap,
|
|
|
|
const struct ieee80211_rx_stats *rxs)
|
|
|
|
{
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
|
|
|
uint32_t flags;
|
|
|
|
struct ieee80211_channel *c;
|
|
|
|
|
|
|
|
if (rxs == NULL)
|
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Strictly speaking we only use freq for now,
|
|
|
|
* however later on we may wish to just store
|
|
|
|
* the ieee for verification.
|
|
|
|
*/
|
|
|
|
if ((rxs->r_flags & IEEE80211_R_FREQ) == 0)
|
|
|
|
return (NULL);
|
|
|
|
if ((rxs->r_flags & IEEE80211_R_IEEE) == 0)
|
|
|
|
return (NULL);
|
2021-06-06 21:14:28 +00:00
|
|
|
if ((rxs->r_flags & IEEE80211_R_BAND) == 0)
|
|
|
|
return (NULL);
|
Begin plumbing ieee80211_rx_stats through the receive path.
Smart NICs with firmware (eg wpi, iwn, the new atheros parts, the intel 7260
series, etc) support doing a lot of things in firmware. This includes but
isn't limited to things like scanning, sending probe requests and receiving
probe responses. However, net80211 doesn't know about any of this - it still
drives the whole scan/probe infrastructure itself.
In order to move towards suppoting smart NICs, the receive path needs to
know about the channel/details for each received packet. In at least
the iwn and 7260 firmware (and I believe wpi, but I haven't tried it yet)
it will do the scanning, power-save and off-channel buffering for you -
all you need to do is handle receiving beacons and probe responses on
channels that aren't what you're currently on. However the whole receive
path is peppered with ic->ic_curchan and manual scan/powersave handling.
The beacon parsing code also checks ic->ic_curchan to determine if the
received beacon is on the correct channel or not.[1]
So:
* add freq/ieee values to ieee80211_rx_stats;
* change ieee80211_parse_beacon() to accept the 'current' channel
as an argument;
* modify the iv_input() and iv_recv_mgmt() methods to include the rx_stats;
* add a new method - ieee80211_lookup_channel_rxstats() - that looks up
a channel based on the contents of ieee80211_rx_stats;
* if it exists, use it in the mgmt path to switch the current channel
(which still defaults to ic->ic_curchan) over to something determined
by rx_stats.
This is enough to kick-start scan offload support in the Intel 7260
driver that Rui/I are working on. It also is a good start for scan
offload support for a handful of existing NICs (wpi, iwn, some USB
parts) and it'll very likely dramatically improve stability/performance
there. It's not the whole thing - notably, we don't need to do powersave,
we should not scan all channels, and we should leave probe request sending
to the firmware and not do it ourselves. But, this allows for continued
development on the above features whilst actually having a somewhat
working NIC.
TODO:
* Finish tidying up how the net80211 input path works.
Right now ieee80211_input / ieee80211_input_all act as the top-level
that everything feeds into; it should change so the MIMO input routines
are those and the legacy routines are phased out.
* The band selection should be done by the driver, not by the net80211
layer.
* ieee80211_lookup_channel_rxstats() only determines 11b or 11g channels
for now - this is enough for scanning, but not 100% true in all cases.
If we ever need to handle off-channel scan support for things like
static-40MHz or static-80MHz, or turbo-G, or half/quarter rates,
then we should extend this.
[1] This is a side effect of frequency-hopping and CCK modes - you
can receive beacons when you think you're on a different channel.
In particular, CCK (which is used by the low 11b rates, eg beacons!)
is decodable from adjacent channels - just at a low SNR.
FH is a side effect of having the hardware/firmware do the frequency
hopping - it may pick up beacons transmitted from other FH networks
that are in a different phase of hopping frequencies.
2015-05-25 16:37:41 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the rx status contains a valid ieee/freq, then
|
|
|
|
* ensure we populate the correct channel information
|
|
|
|
* in rxchan before passing it up to the scan infrastructure.
|
|
|
|
* Offload NICs will pass up beacons from all channels
|
|
|
|
* during background scans.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Determine a band */
|
2021-06-06 21:14:28 +00:00
|
|
|
switch (rxs->c_band) {
|
|
|
|
case IEEE80211_CHAN_2GHZ:
|
2015-06-05 06:49:08 +00:00
|
|
|
flags = IEEE80211_CHAN_G;
|
2021-06-06 21:14:28 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_CHAN_5GHZ:
|
Begin plumbing ieee80211_rx_stats through the receive path.
Smart NICs with firmware (eg wpi, iwn, the new atheros parts, the intel 7260
series, etc) support doing a lot of things in firmware. This includes but
isn't limited to things like scanning, sending probe requests and receiving
probe responses. However, net80211 doesn't know about any of this - it still
drives the whole scan/probe infrastructure itself.
In order to move towards suppoting smart NICs, the receive path needs to
know about the channel/details for each received packet. In at least
the iwn and 7260 firmware (and I believe wpi, but I haven't tried it yet)
it will do the scanning, power-save and off-channel buffering for you -
all you need to do is handle receiving beacons and probe responses on
channels that aren't what you're currently on. However the whole receive
path is peppered with ic->ic_curchan and manual scan/powersave handling.
The beacon parsing code also checks ic->ic_curchan to determine if the
received beacon is on the correct channel or not.[1]
So:
* add freq/ieee values to ieee80211_rx_stats;
* change ieee80211_parse_beacon() to accept the 'current' channel
as an argument;
* modify the iv_input() and iv_recv_mgmt() methods to include the rx_stats;
* add a new method - ieee80211_lookup_channel_rxstats() - that looks up
a channel based on the contents of ieee80211_rx_stats;
* if it exists, use it in the mgmt path to switch the current channel
(which still defaults to ic->ic_curchan) over to something determined
by rx_stats.
This is enough to kick-start scan offload support in the Intel 7260
driver that Rui/I are working on. It also is a good start for scan
offload support for a handful of existing NICs (wpi, iwn, some USB
parts) and it'll very likely dramatically improve stability/performance
there. It's not the whole thing - notably, we don't need to do powersave,
we should not scan all channels, and we should leave probe request sending
to the firmware and not do it ourselves. But, this allows for continued
development on the above features whilst actually having a somewhat
working NIC.
TODO:
* Finish tidying up how the net80211 input path works.
Right now ieee80211_input / ieee80211_input_all act as the top-level
that everything feeds into; it should change so the MIMO input routines
are those and the legacy routines are phased out.
* The band selection should be done by the driver, not by the net80211
layer.
* ieee80211_lookup_channel_rxstats() only determines 11b or 11g channels
for now - this is enough for scanning, but not 100% true in all cases.
If we ever need to handle off-channel scan support for things like
static-40MHz or static-80MHz, or turbo-G, or half/quarter rates,
then we should extend this.
[1] This is a side effect of frequency-hopping and CCK modes - you
can receive beacons when you think you're on a different channel.
In particular, CCK (which is used by the low 11b rates, eg beacons!)
is decodable from adjacent channels - just at a low SNR.
FH is a side effect of having the hardware/firmware do the frequency
hopping - it may pick up beacons transmitted from other FH networks
that are in a different phase of hopping frequencies.
2015-05-25 16:37:41 +00:00
|
|
|
flags = IEEE80211_CHAN_A;
|
2021-06-06 21:14:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (rxs->c_freq < 3000) {
|
|
|
|
flags = IEEE80211_CHAN_G;
|
|
|
|
} else {
|
|
|
|
flags = IEEE80211_CHAN_A;
|
|
|
|
}
|
|
|
|
break;
|
Begin plumbing ieee80211_rx_stats through the receive path.
Smart NICs with firmware (eg wpi, iwn, the new atheros parts, the intel 7260
series, etc) support doing a lot of things in firmware. This includes but
isn't limited to things like scanning, sending probe requests and receiving
probe responses. However, net80211 doesn't know about any of this - it still
drives the whole scan/probe infrastructure itself.
In order to move towards suppoting smart NICs, the receive path needs to
know about the channel/details for each received packet. In at least
the iwn and 7260 firmware (and I believe wpi, but I haven't tried it yet)
it will do the scanning, power-save and off-channel buffering for you -
all you need to do is handle receiving beacons and probe responses on
channels that aren't what you're currently on. However the whole receive
path is peppered with ic->ic_curchan and manual scan/powersave handling.
The beacon parsing code also checks ic->ic_curchan to determine if the
received beacon is on the correct channel or not.[1]
So:
* add freq/ieee values to ieee80211_rx_stats;
* change ieee80211_parse_beacon() to accept the 'current' channel
as an argument;
* modify the iv_input() and iv_recv_mgmt() methods to include the rx_stats;
* add a new method - ieee80211_lookup_channel_rxstats() - that looks up
a channel based on the contents of ieee80211_rx_stats;
* if it exists, use it in the mgmt path to switch the current channel
(which still defaults to ic->ic_curchan) over to something determined
by rx_stats.
This is enough to kick-start scan offload support in the Intel 7260
driver that Rui/I are working on. It also is a good start for scan
offload support for a handful of existing NICs (wpi, iwn, some USB
parts) and it'll very likely dramatically improve stability/performance
there. It's not the whole thing - notably, we don't need to do powersave,
we should not scan all channels, and we should leave probe request sending
to the firmware and not do it ourselves. But, this allows for continued
development on the above features whilst actually having a somewhat
working NIC.
TODO:
* Finish tidying up how the net80211 input path works.
Right now ieee80211_input / ieee80211_input_all act as the top-level
that everything feeds into; it should change so the MIMO input routines
are those and the legacy routines are phased out.
* The band selection should be done by the driver, not by the net80211
layer.
* ieee80211_lookup_channel_rxstats() only determines 11b or 11g channels
for now - this is enough for scanning, but not 100% true in all cases.
If we ever need to handle off-channel scan support for things like
static-40MHz or static-80MHz, or turbo-G, or half/quarter rates,
then we should extend this.
[1] This is a side effect of frequency-hopping and CCK modes - you
can receive beacons when you think you're on a different channel.
In particular, CCK (which is used by the low 11b rates, eg beacons!)
is decodable from adjacent channels - just at a low SNR.
FH is a side effect of having the hardware/firmware do the frequency
hopping - it may pick up beacons transmitted from other FH networks
that are in a different phase of hopping frequencies.
2015-05-25 16:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Channel lookup */
|
|
|
|
c = ieee80211_find_channel(ic, rxs->c_freq, flags);
|
|
|
|
|
|
|
|
IEEE80211_DPRINTF(vap, IEEE80211_MSG_INPUT,
|
|
|
|
"%s: freq=%d, ieee=%d, flags=0x%08x; c=%p\n",
|
2020-08-17 16:28:59 +00:00
|
|
|
__func__, (int) rxs->c_freq, (int) rxs->c_ieee, flags, c);
|
Begin plumbing ieee80211_rx_stats through the receive path.
Smart NICs with firmware (eg wpi, iwn, the new atheros parts, the intel 7260
series, etc) support doing a lot of things in firmware. This includes but
isn't limited to things like scanning, sending probe requests and receiving
probe responses. However, net80211 doesn't know about any of this - it still
drives the whole scan/probe infrastructure itself.
In order to move towards suppoting smart NICs, the receive path needs to
know about the channel/details for each received packet. In at least
the iwn and 7260 firmware (and I believe wpi, but I haven't tried it yet)
it will do the scanning, power-save and off-channel buffering for you -
all you need to do is handle receiving beacons and probe responses on
channels that aren't what you're currently on. However the whole receive
path is peppered with ic->ic_curchan and manual scan/powersave handling.
The beacon parsing code also checks ic->ic_curchan to determine if the
received beacon is on the correct channel or not.[1]
So:
* add freq/ieee values to ieee80211_rx_stats;
* change ieee80211_parse_beacon() to accept the 'current' channel
as an argument;
* modify the iv_input() and iv_recv_mgmt() methods to include the rx_stats;
* add a new method - ieee80211_lookup_channel_rxstats() - that looks up
a channel based on the contents of ieee80211_rx_stats;
* if it exists, use it in the mgmt path to switch the current channel
(which still defaults to ic->ic_curchan) over to something determined
by rx_stats.
This is enough to kick-start scan offload support in the Intel 7260
driver that Rui/I are working on. It also is a good start for scan
offload support for a handful of existing NICs (wpi, iwn, some USB
parts) and it'll very likely dramatically improve stability/performance
there. It's not the whole thing - notably, we don't need to do powersave,
we should not scan all channels, and we should leave probe request sending
to the firmware and not do it ourselves. But, this allows for continued
development on the above features whilst actually having a somewhat
working NIC.
TODO:
* Finish tidying up how the net80211 input path works.
Right now ieee80211_input / ieee80211_input_all act as the top-level
that everything feeds into; it should change so the MIMO input routines
are those and the legacy routines are phased out.
* The band selection should be done by the driver, not by the net80211
layer.
* ieee80211_lookup_channel_rxstats() only determines 11b or 11g channels
for now - this is enough for scanning, but not 100% true in all cases.
If we ever need to handle off-channel scan support for things like
static-40MHz or static-80MHz, or turbo-G, or half/quarter rates,
then we should extend this.
[1] This is a side effect of frequency-hopping and CCK modes - you
can receive beacons when you think you're on a different channel.
In particular, CCK (which is used by the low 11b rates, eg beacons!)
is decodable from adjacent channels - just at a low SNR.
FH is a side effect of having the hardware/firmware do the frequency
hopping - it may pick up beacons transmitted from other FH networks
that are in a different phase of hopping frequencies.
2015-05-25 16:37:41 +00:00
|
|
|
|
|
|
|
return (c);
|
|
|
|
}
|
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
static void
|
2008-04-20 20:35:46 +00:00
|
|
|
addmedia(struct ifmedia *media, int caps, int addsta, int mode, int mword)
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
{
|
|
|
|
#define ADD(_ic, _s, _o) \
|
2008-04-20 20:35:46 +00:00
|
|
|
ifmedia_add(media, \
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL)
|
2018-07-10 23:30:19 +00:00
|
|
|
static const u_int mopts[IEEE80211_MODE_MAX] = {
|
2009-02-03 22:32:26 +00:00
|
|
|
[IEEE80211_MODE_AUTO] = IFM_AUTO,
|
|
|
|
[IEEE80211_MODE_11A] = IFM_IEEE80211_11A,
|
|
|
|
[IEEE80211_MODE_11B] = IFM_IEEE80211_11B,
|
|
|
|
[IEEE80211_MODE_11G] = IFM_IEEE80211_11G,
|
|
|
|
[IEEE80211_MODE_FH] = IFM_IEEE80211_FH,
|
|
|
|
[IEEE80211_MODE_TURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,
|
|
|
|
[IEEE80211_MODE_TURBO_G] = IFM_IEEE80211_11G|IFM_IEEE80211_TURBO,
|
|
|
|
[IEEE80211_MODE_STURBO_A] = IFM_IEEE80211_11A|IFM_IEEE80211_TURBO,
|
2009-02-19 05:21:54 +00:00
|
|
|
[IEEE80211_MODE_HALF] = IFM_IEEE80211_11A, /* XXX */
|
|
|
|
[IEEE80211_MODE_QUARTER] = IFM_IEEE80211_11A, /* XXX */
|
2009-02-03 22:32:26 +00:00
|
|
|
[IEEE80211_MODE_11NA] = IFM_IEEE80211_11NA,
|
|
|
|
[IEEE80211_MODE_11NG] = IFM_IEEE80211_11NG,
|
2017-01-10 07:50:21 +00:00
|
|
|
[IEEE80211_MODE_VHT_2GHZ] = IFM_IEEE80211_VHT2G,
|
|
|
|
[IEEE80211_MODE_VHT_5GHZ] = IFM_IEEE80211_VHT5G,
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
};
|
|
|
|
u_int mopt;
|
|
|
|
|
|
|
|
mopt = mopts[mode];
|
2008-04-20 20:35:46 +00:00
|
|
|
if (addsta)
|
|
|
|
ADD(ic, mword, mopt); /* STA mode has no cap */
|
|
|
|
if (caps & IEEE80211_C_IBSS)
|
|
|
|
ADD(media, mword, mopt | IFM_IEEE80211_ADHOC);
|
|
|
|
if (caps & IEEE80211_C_HOSTAP)
|
|
|
|
ADD(media, mword, mopt | IFM_IEEE80211_HOSTAP);
|
|
|
|
if (caps & IEEE80211_C_AHDEMO)
|
|
|
|
ADD(media, mword, mopt | IFM_IEEE80211_ADHOC | IFM_FLAG0);
|
|
|
|
if (caps & IEEE80211_C_MONITOR)
|
|
|
|
ADD(media, mword, mopt | IFM_IEEE80211_MONITOR);
|
|
|
|
if (caps & IEEE80211_C_WDS)
|
|
|
|
ADD(media, mword, mopt | IFM_IEEE80211_WDS);
|
Implementation of the upcoming Wireless Mesh standard, 802.11s, on the
net80211 wireless stack. This work is based on the March 2009 D3.0 draft
standard. This standard is expected to become final next year.
This includes two main net80211 modules, ieee80211_mesh.c
which deals with peer link management, link metric calculation,
routing table control and mesh configuration and ieee80211_hwmp.c
which deals with the actually routing process on the mesh network.
HWMP is the mandatory routing protocol on by the mesh standard, but
others, such as RA-OLSR, can be implemented.
Authentication and encryption are not implemented.
There are several scripts under tools/tools/net80211/scripts that can be
used to test different mesh network topologies and they also teach you
how to setup a mesh vap (for the impatient: ifconfig wlan0 create
wlandev ... wlanmode mesh).
A new build option is available: IEEE80211_SUPPORT_MESH and it's enabled
by default on GENERIC kernels for i386, amd64, sparc64 and pc98.
Drivers that support mesh networks right now are: ath, ral and mwl.
More information at: http://wiki.freebsd.org/WifiMesh
Please note that this work is experimental. Also, please note that
bridging a mesh vap with another network interface is not yet supported.
Many thanks to the FreeBSD Foundation for sponsoring this project and to
Sam Leffler for his support.
Also, I would like to thank Gateworks Corporation for sending me a
Cambria board which was used during the development of this project.
Reviewed by: sam
Approved by: re (kensmith)
Obtained from: projects/mesh11s
2009-07-11 15:02:45 +00:00
|
|
|
if (caps & IEEE80211_C_MBSS)
|
|
|
|
ADD(media, mword, mopt | IFM_IEEE80211_MBSS);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
#undef ADD
|
|
|
|
}
|
|
|
|
|
2003-06-23 16:55:01 +00:00
|
|
|
/*
|
|
|
|
* Setup the media data structures according to the channel and
|
2008-04-20 20:35:46 +00:00
|
|
|
* rate tables.
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
2008-04-20 20:35:46 +00:00
|
|
|
static int
|
|
|
|
ieee80211_media_setup(struct ieee80211com *ic,
|
|
|
|
struct ifmedia *media, int caps, int addsta,
|
2003-06-23 16:55:01 +00:00
|
|
|
ifm_change_cb_t media_change, ifm_stat_cb_t media_stat)
|
|
|
|
{
|
2011-12-17 10:23:17 +00:00
|
|
|
int i, j, rate, maxrate, mword, r;
|
|
|
|
enum ieee80211_phymode mode;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
const struct ieee80211_rateset *rs;
|
2003-06-23 16:55:01 +00:00
|
|
|
struct ieee80211_rateset allrates;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fill in media characteristics.
|
|
|
|
*/
|
2008-04-20 20:35:46 +00:00
|
|
|
ifmedia_init(media, 0, media_change, media_stat);
|
2003-06-23 16:55:01 +00:00
|
|
|
maxrate = 0;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/*
|
|
|
|
* Add media for legacy operating modes.
|
|
|
|
*/
|
2003-06-23 16:55:01 +00:00
|
|
|
memset(&allrates, 0, sizeof(allrates));
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
for (mode = IEEE80211_MODE_AUTO; mode < IEEE80211_MODE_11NA; mode++) {
|
2007-03-11 22:37:32 +00:00
|
|
|
if (isclr(ic->ic_modecaps, mode))
|
2003-06-23 16:55:01 +00:00
|
|
|
continue;
|
2008-04-20 20:35:46 +00:00
|
|
|
addmedia(media, caps, addsta, mode, IFM_AUTO);
|
2003-06-23 16:55:01 +00:00
|
|
|
if (mode == IEEE80211_MODE_AUTO)
|
|
|
|
continue;
|
|
|
|
rs = &ic->ic_sup_rates[mode];
|
|
|
|
for (i = 0; i < rs->rs_nrates; i++) {
|
|
|
|
rate = rs->rs_rates[i];
|
|
|
|
mword = ieee80211_rate2media(ic, rate, mode);
|
|
|
|
if (mword == 0)
|
|
|
|
continue;
|
2008-04-20 20:35:46 +00:00
|
|
|
addmedia(media, caps, addsta, mode, mword);
|
2003-06-23 16:55:01 +00:00
|
|
|
/*
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
* Add legacy rate to the collection of all rates.
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
|
|
|
r = rate & IEEE80211_RATE_VAL;
|
|
|
|
for (j = 0; j < allrates.rs_nrates; j++)
|
|
|
|
if (allrates.rs_rates[j] == r)
|
|
|
|
break;
|
|
|
|
if (j == allrates.rs_nrates) {
|
|
|
|
/* unique, add to the set */
|
|
|
|
allrates.rs_rates[j] = r;
|
|
|
|
allrates.rs_nrates++;
|
|
|
|
}
|
|
|
|
rate = (rate & IEEE80211_RATE_VAL) / 2;
|
|
|
|
if (rate > maxrate)
|
|
|
|
maxrate = rate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < allrates.rs_nrates; i++) {
|
|
|
|
mword = ieee80211_rate2media(ic, allrates.rs_rates[i],
|
|
|
|
IEEE80211_MODE_AUTO);
|
|
|
|
if (mword == 0)
|
|
|
|
continue;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/* NB: remove media options from mword */
|
2008-04-20 20:35:46 +00:00
|
|
|
addmedia(media, caps, addsta,
|
|
|
|
IEEE80211_MODE_AUTO, IFM_SUBTYPE(mword));
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Add HT/11n media. Note that we do not have enough
|
|
|
|
* bits in the media subtype to express the MCS so we
|
|
|
|
* use a "placeholder" media subtype and any fixed MCS
|
|
|
|
* must be specified with a different mechanism.
|
|
|
|
*/
|
2009-02-19 05:21:54 +00:00
|
|
|
for (; mode <= IEEE80211_MODE_11NG; mode++) {
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
if (isclr(ic->ic_modecaps, mode))
|
|
|
|
continue;
|
2008-04-20 20:35:46 +00:00
|
|
|
addmedia(media, caps, addsta, mode, IFM_AUTO);
|
|
|
|
addmedia(media, caps, addsta, mode, IFM_IEEE80211_MCS);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
}
|
|
|
|
if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA) ||
|
|
|
|
isset(ic->ic_modecaps, IEEE80211_MODE_11NG)) {
|
2008-04-20 20:35:46 +00:00
|
|
|
addmedia(media, caps, addsta,
|
|
|
|
IEEE80211_MODE_AUTO, IFM_IEEE80211_MCS);
|
2011-03-13 11:47:43 +00:00
|
|
|
i = ic->ic_txstream * 8 - 1;
|
|
|
|
if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) &&
|
|
|
|
(ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI40))
|
|
|
|
rate = ieee80211_htrates[i].ht40_rate_400ns;
|
|
|
|
else if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40))
|
|
|
|
rate = ieee80211_htrates[i].ht40_rate_800ns;
|
|
|
|
else if ((ic->ic_htcaps & IEEE80211_HTCAP_SHORTGI20))
|
|
|
|
rate = ieee80211_htrates[i].ht20_rate_400ns;
|
|
|
|
else
|
|
|
|
rate = ieee80211_htrates[i].ht20_rate_800ns;
|
|
|
|
if (rate > maxrate)
|
|
|
|
maxrate = rate;
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
2017-01-10 07:50:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add VHT media.
|
2020-08-23 21:42:23 +00:00
|
|
|
* XXX-BZ skip "VHT_2GHZ" for now.
|
2017-01-10 07:50:21 +00:00
|
|
|
*/
|
2020-08-23 21:42:23 +00:00
|
|
|
for (mode = IEEE80211_MODE_VHT_5GHZ; mode <= IEEE80211_MODE_VHT_5GHZ;
|
|
|
|
mode++) {
|
2017-01-10 07:50:21 +00:00
|
|
|
if (isclr(ic->ic_modecaps, mode))
|
|
|
|
continue;
|
|
|
|
addmedia(media, caps, addsta, mode, IFM_AUTO);
|
|
|
|
addmedia(media, caps, addsta, mode, IFM_IEEE80211_VHT);
|
2020-08-23 21:42:23 +00:00
|
|
|
}
|
|
|
|
if (isset(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ)) {
|
|
|
|
addmedia(media, caps, addsta,
|
|
|
|
IEEE80211_MODE_AUTO, IFM_IEEE80211_VHT);
|
2017-01-10 07:50:21 +00:00
|
|
|
|
|
|
|
/* XXX TODO: VHT maxrate */
|
|
|
|
}
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
return maxrate;
|
|
|
|
}
|
|
|
|
|
2009-02-19 05:21:54 +00:00
|
|
|
/* XXX inline or eliminate? */
|
2006-12-27 18:46:18 +00:00
|
|
|
const struct ieee80211_rateset *
|
|
|
|
ieee80211_get_suprates(struct ieee80211com *ic, const struct ieee80211_channel *c)
|
|
|
|
{
|
2009-02-19 04:33:36 +00:00
|
|
|
/* XXX does this work for 11ng basic rates? */
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
return &ic->ic_sup_rates[ieee80211_chan2mode(c)];
|
2006-12-27 18:46:18 +00:00
|
|
|
}
|
|
|
|
|
2017-03-03 01:06:27 +00:00
|
|
|
/* XXX inline or eliminate? */
|
|
|
|
const struct ieee80211_htrateset *
|
|
|
|
ieee80211_get_suphtrates(struct ieee80211com *ic,
|
|
|
|
const struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
return &ic->ic_sup_htrates;
|
|
|
|
}
|
|
|
|
|
2004-12-08 17:26:47 +00:00
|
|
|
void
|
|
|
|
ieee80211_announce(struct ieee80211com *ic)
|
|
|
|
{
|
2011-12-17 10:23:17 +00:00
|
|
|
int i, rate, mword;
|
|
|
|
enum ieee80211_phymode mode;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
const struct ieee80211_rateset *rs;
|
2004-12-08 17:26:47 +00:00
|
|
|
|
2007-09-18 20:51:55 +00:00
|
|
|
/* NB: skip AUTO since it has no rates */
|
|
|
|
for (mode = IEEE80211_MODE_AUTO+1; mode < IEEE80211_MODE_11NA; mode++) {
|
2007-03-11 22:37:32 +00:00
|
|
|
if (isclr(ic->ic_modecaps, mode))
|
2004-12-08 17:26:47 +00:00
|
|
|
continue;
|
2015-05-25 14:30:44 +00:00
|
|
|
ic_printf(ic, "%s rates: ", ieee80211_phymode_name[mode]);
|
2004-12-08 17:26:47 +00:00
|
|
|
rs = &ic->ic_sup_rates[mode];
|
|
|
|
for (i = 0; i < rs->rs_nrates; i++) {
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
mword = ieee80211_rate2media(ic, rs->rs_rates[i], mode);
|
2004-12-08 17:26:47 +00:00
|
|
|
if (mword == 0)
|
|
|
|
continue;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
rate = ieee80211_media2rate(mword);
|
2004-12-08 17:26:47 +00:00
|
|
|
printf("%s%d%sMbps", (i != 0 ? " " : ""),
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
rate / 2, ((rate & 0x1) != 0 ? ".5" : ""));
|
2004-12-08 17:26:47 +00:00
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_ht_announce(ic);
|
2017-01-13 06:53:56 +00:00
|
|
|
ieee80211_vht_announce(ic);
|
2004-12-08 17:26:47 +00:00
|
|
|
}
|
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
void
|
|
|
|
ieee80211_announce_channels(struct ieee80211com *ic)
|
2003-06-23 16:55:01 +00:00
|
|
|
{
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
const struct ieee80211_channel *c;
|
|
|
|
char type;
|
|
|
|
int i, cw;
|
|
|
|
|
|
|
|
printf("Chan Freq CW RegPwr MinPwr MaxPwr\n");
|
|
|
|
for (i = 0; i < ic->ic_nchans; i++) {
|
|
|
|
c = &ic->ic_channels[i];
|
|
|
|
if (IEEE80211_IS_CHAN_ST(c))
|
|
|
|
type = 'S';
|
|
|
|
else if (IEEE80211_IS_CHAN_108A(c))
|
|
|
|
type = 'T';
|
|
|
|
else if (IEEE80211_IS_CHAN_108G(c))
|
|
|
|
type = 'G';
|
|
|
|
else if (IEEE80211_IS_CHAN_HT(c))
|
|
|
|
type = 'n';
|
|
|
|
else if (IEEE80211_IS_CHAN_A(c))
|
|
|
|
type = 'a';
|
|
|
|
else if (IEEE80211_IS_CHAN_ANYG(c))
|
|
|
|
type = 'g';
|
|
|
|
else if (IEEE80211_IS_CHAN_B(c))
|
|
|
|
type = 'b';
|
|
|
|
else
|
|
|
|
type = 'f';
|
|
|
|
if (IEEE80211_IS_CHAN_HT40(c) || IEEE80211_IS_CHAN_TURBO(c))
|
|
|
|
cw = 40;
|
|
|
|
else if (IEEE80211_IS_CHAN_HALF(c))
|
|
|
|
cw = 10;
|
|
|
|
else if (IEEE80211_IS_CHAN_QUARTER(c))
|
|
|
|
cw = 5;
|
|
|
|
else
|
|
|
|
cw = 20;
|
|
|
|
printf("%4d %4d%c %2d%c %6d %4d.%d %4d.%d\n"
|
|
|
|
, c->ic_ieee, c->ic_freq, type
|
|
|
|
, cw
|
|
|
|
, IEEE80211_IS_CHAN_HT40U(c) ? '+' :
|
|
|
|
IEEE80211_IS_CHAN_HT40D(c) ? '-' : ' '
|
|
|
|
, c->ic_maxregpower
|
|
|
|
, c->ic_minpower / 2, c->ic_minpower & 1 ? 5 : 0
|
|
|
|
, c->ic_maxpower / 2, c->ic_maxpower & 1 ? 5 : 0
|
|
|
|
);
|
|
|
|
}
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
static int
|
2008-10-25 23:31:20 +00:00
|
|
|
media2mode(const struct ifmedia_entry *ime, uint32_t flags, uint16_t *mode)
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
{
|
2003-06-23 16:55:01 +00:00
|
|
|
switch (IFM_MODE(ime->ifm_media)) {
|
|
|
|
case IFM_IEEE80211_11A:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_11A;
|
2003-06-23 16:55:01 +00:00
|
|
|
break;
|
|
|
|
case IFM_IEEE80211_11B:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_11B;
|
2003-06-23 16:55:01 +00:00
|
|
|
break;
|
|
|
|
case IFM_IEEE80211_11G:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_11G;
|
2003-06-23 16:55:01 +00:00
|
|
|
break;
|
2004-01-15 08:44:27 +00:00
|
|
|
case IFM_IEEE80211_FH:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_FH;
|
2004-01-15 08:44:27 +00:00
|
|
|
break;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
case IFM_IEEE80211_11NA:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_11NA;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
break;
|
|
|
|
case IFM_IEEE80211_11NG:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_11NG;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
break;
|
2020-08-23 21:42:23 +00:00
|
|
|
case IFM_IEEE80211_VHT2G:
|
|
|
|
*mode = IEEE80211_MODE_VHT_2GHZ;
|
|
|
|
break;
|
|
|
|
case IFM_IEEE80211_VHT5G:
|
|
|
|
*mode = IEEE80211_MODE_VHT_5GHZ;
|
|
|
|
break;
|
2003-06-23 16:55:01 +00:00
|
|
|
case IFM_AUTO:
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_AUTO;
|
2003-06-23 16:55:01 +00:00
|
|
|
break;
|
|
|
|
default:
|
2008-04-20 20:35:46 +00:00
|
|
|
return 0;
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
/*
|
2004-12-08 17:26:47 +00:00
|
|
|
* Turbo mode is an ``option''.
|
|
|
|
* XXX does not apply to AUTO
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
|
|
|
if (ime->ifm_media & IFM_IEEE80211_TURBO) {
|
2008-04-20 20:35:46 +00:00
|
|
|
if (*mode == IEEE80211_MODE_11A) {
|
2008-10-25 23:31:20 +00:00
|
|
|
if (flags & IEEE80211_F_TURBOP)
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_TURBO_A;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
else
|
2008-04-20 20:35:46 +00:00
|
|
|
*mode = IEEE80211_MODE_STURBO_A;
|
|
|
|
} else if (*mode == IEEE80211_MODE_11G)
|
|
|
|
*mode = IEEE80211_MODE_TURBO_G;
|
2004-12-08 17:26:47 +00:00
|
|
|
else
|
2008-04-20 20:35:46 +00:00
|
|
|
return 0;
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/* XXX HT40 +/- */
|
2008-04-20 20:35:46 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle a media change request on the vap interface.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
ieee80211_media_change(struct ifnet *ifp)
|
|
|
|
{
|
|
|
|
struct ieee80211vap *vap = ifp->if_softc;
|
|
|
|
struct ifmedia_entry *ime = vap->iv_media.ifm_cur;
|
2008-10-25 23:31:20 +00:00
|
|
|
uint16_t newmode;
|
2008-04-20 20:35:46 +00:00
|
|
|
|
2008-10-25 23:31:20 +00:00
|
|
|
if (!media2mode(ime, vap->iv_flags, &newmode))
|
2008-04-20 20:35:46 +00:00
|
|
|
return EINVAL;
|
2008-10-25 23:31:20 +00:00
|
|
|
if (vap->iv_des_mode != newmode) {
|
|
|
|
vap->iv_des_mode = newmode;
|
2009-06-02 20:00:43 +00:00
|
|
|
/* XXX kick state machine if up+running */
|
2008-04-20 20:35:46 +00:00
|
|
|
}
|
|
|
|
return 0;
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/*
|
|
|
|
* Common code to calculate the media status word
|
|
|
|
* from the operating mode and channel state.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
media_status(enum ieee80211_opmode opmode, const struct ieee80211_channel *chan)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
|
|
|
|
status = IFM_IEEE80211;
|
|
|
|
switch (opmode) {
|
|
|
|
case IEEE80211_M_STA:
|
|
|
|
break;
|
|
|
|
case IEEE80211_M_IBSS:
|
|
|
|
status |= IFM_IEEE80211_ADHOC;
|
|
|
|
break;
|
|
|
|
case IEEE80211_M_HOSTAP:
|
|
|
|
status |= IFM_IEEE80211_HOSTAP;
|
|
|
|
break;
|
|
|
|
case IEEE80211_M_MONITOR:
|
|
|
|
status |= IFM_IEEE80211_MONITOR;
|
|
|
|
break;
|
|
|
|
case IEEE80211_M_AHDEMO:
|
|
|
|
status |= IFM_IEEE80211_ADHOC | IFM_FLAG0;
|
|
|
|
break;
|
|
|
|
case IEEE80211_M_WDS:
|
2008-04-20 20:35:46 +00:00
|
|
|
status |= IFM_IEEE80211_WDS;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
break;
|
Implementation of the upcoming Wireless Mesh standard, 802.11s, on the
net80211 wireless stack. This work is based on the March 2009 D3.0 draft
standard. This standard is expected to become final next year.
This includes two main net80211 modules, ieee80211_mesh.c
which deals with peer link management, link metric calculation,
routing table control and mesh configuration and ieee80211_hwmp.c
which deals with the actually routing process on the mesh network.
HWMP is the mandatory routing protocol on by the mesh standard, but
others, such as RA-OLSR, can be implemented.
Authentication and encryption are not implemented.
There are several scripts under tools/tools/net80211/scripts that can be
used to test different mesh network topologies and they also teach you
how to setup a mesh vap (for the impatient: ifconfig wlan0 create
wlandev ... wlanmode mesh).
A new build option is available: IEEE80211_SUPPORT_MESH and it's enabled
by default on GENERIC kernels for i386, amd64, sparc64 and pc98.
Drivers that support mesh networks right now are: ath, ral and mwl.
More information at: http://wiki.freebsd.org/WifiMesh
Please note that this work is experimental. Also, please note that
bridging a mesh vap with another network interface is not yet supported.
Many thanks to the FreeBSD Foundation for sponsoring this project and to
Sam Leffler for his support.
Also, I would like to thank Gateworks Corporation for sending me a
Cambria board which was used during the development of this project.
Reviewed by: sam
Approved by: re (kensmith)
Obtained from: projects/mesh11s
2009-07-11 15:02:45 +00:00
|
|
|
case IEEE80211_M_MBSS:
|
|
|
|
status |= IFM_IEEE80211_MBSS;
|
|
|
|
break;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
}
|
2022-07-29 00:10:34 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT_5GHZ(chan)) {
|
|
|
|
status |= IFM_IEEE80211_VHT5G;
|
|
|
|
} else if (IEEE80211_IS_CHAN_VHT_2GHZ(chan)) {
|
|
|
|
status |= IFM_IEEE80211_VHT2G;
|
|
|
|
} else if (IEEE80211_IS_CHAN_HTA(chan)) {
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
status |= IFM_IEEE80211_11NA;
|
|
|
|
} else if (IEEE80211_IS_CHAN_HTG(chan)) {
|
|
|
|
status |= IFM_IEEE80211_11NG;
|
|
|
|
} else if (IEEE80211_IS_CHAN_A(chan)) {
|
|
|
|
status |= IFM_IEEE80211_11A;
|
|
|
|
} else if (IEEE80211_IS_CHAN_B(chan)) {
|
|
|
|
status |= IFM_IEEE80211_11B;
|
|
|
|
} else if (IEEE80211_IS_CHAN_ANYG(chan)) {
|
|
|
|
status |= IFM_IEEE80211_11G;
|
|
|
|
} else if (IEEE80211_IS_CHAN_FHSS(chan)) {
|
|
|
|
status |= IFM_IEEE80211_FH;
|
|
|
|
}
|
|
|
|
/* XXX else complain? */
|
|
|
|
|
|
|
|
if (IEEE80211_IS_CHAN_TURBO(chan))
|
|
|
|
status |= IFM_IEEE80211_TURBO;
|
2008-04-20 20:35:46 +00:00
|
|
|
#if 0
|
|
|
|
if (IEEE80211_IS_CHAN_HT20(chan))
|
|
|
|
status |= IFM_IEEE80211_HT20;
|
|
|
|
if (IEEE80211_IS_CHAN_HT40(chan))
|
|
|
|
status |= IFM_IEEE80211_HT40;
|
|
|
|
#endif
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2003-06-23 16:55:01 +00:00
|
|
|
void
|
|
|
|
ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr)
|
|
|
|
{
|
2008-04-20 20:35:46 +00:00
|
|
|
struct ieee80211vap *vap = ifp->if_softc;
|
|
|
|
struct ieee80211com *ic = vap->iv_ic;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
enum ieee80211_phymode mode;
|
2003-06-23 16:55:01 +00:00
|
|
|
|
|
|
|
imr->ifm_status = IFM_AVALID;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/*
|
|
|
|
* NB: use the current channel's mode to lock down a xmit
|
|
|
|
* rate only when running; otherwise we may have a mismatch
|
|
|
|
* in which case the rate will not be convertible.
|
|
|
|
*/
|
2014-04-23 22:43:39 +00:00
|
|
|
if (vap->iv_state == IEEE80211_S_RUN ||
|
|
|
|
vap->iv_state == IEEE80211_S_SLEEP) {
|
2003-06-23 16:55:01 +00:00
|
|
|
imr->ifm_status |= IFM_ACTIVE;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
mode = ieee80211_chan2mode(ic->ic_curchan);
|
|
|
|
} else
|
|
|
|
mode = IEEE80211_MODE_AUTO;
|
2008-04-20 20:35:46 +00:00
|
|
|
imr->ifm_active = media_status(vap->iv_opmode, ic->ic_curchan);
|
2004-12-08 17:26:47 +00:00
|
|
|
/*
|
|
|
|
* Calculate a current rate if possible.
|
|
|
|
*/
|
2008-04-20 20:35:46 +00:00
|
|
|
if (vap->iv_txparms[mode].ucastrate != IEEE80211_FIXED_RATE_NONE) {
|
2004-12-08 17:26:47 +00:00
|
|
|
/*
|
|
|
|
* A fixed rate is set, report that.
|
|
|
|
*/
|
|
|
|
imr->ifm_active |= ieee80211_rate2media(ic,
|
2008-04-20 20:35:46 +00:00
|
|
|
vap->iv_txparms[mode].ucastrate, mode);
|
|
|
|
} else if (vap->iv_opmode == IEEE80211_M_STA) {
|
2004-12-08 17:26:47 +00:00
|
|
|
/*
|
|
|
|
* In station mode report the current transmit rate.
|
|
|
|
*/
|
|
|
|
imr->ifm_active |= ieee80211_rate2media(ic,
|
2008-04-20 20:35:46 +00:00
|
|
|
vap->iv_bss->ni_txrate, mode);
|
2004-05-05 15:48:06 +00:00
|
|
|
} else
|
2004-12-08 17:26:47 +00:00
|
|
|
imr->ifm_active |= IFM_AUTO;
|
2008-04-20 20:35:46 +00:00
|
|
|
if (imr->ifm_status & IFM_ACTIVE)
|
|
|
|
imr->ifm_current = imr->ifm_active;
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the current phy mode and recalculate the active channel
|
|
|
|
* set based on the available channels for this mode. Also
|
|
|
|
* select a new default/current channel if the current one is
|
|
|
|
* inappropriate for this mode.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode)
|
|
|
|
{
|
|
|
|
/*
|
2007-01-15 01:12:28 +00:00
|
|
|
* Adjust basic rates in 11b/11g supported rate set.
|
|
|
|
* Note that if operating on a hal/quarter rate channel
|
|
|
|
* this is a noop as those rates sets are different
|
|
|
|
* and used instead.
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
2007-01-15 01:12:28 +00:00
|
|
|
if (mode == IEEE80211_MODE_11G || mode == IEEE80211_MODE_11B)
|
2008-04-20 20:35:46 +00:00
|
|
|
ieee80211_setbasicrates(&ic->ic_sup_rates[mode], mode);
|
2007-01-15 01:12:28 +00:00
|
|
|
|
2003-06-23 16:55:01 +00:00
|
|
|
ic->ic_curmode = mode;
|
[net80211] Migrate short slot time configuration into per-vap and deferred taskqueue updates.
The 11b/11g ERP and slot time update handling are two things which weren't
migrated into the per-VAP state when Sam did the initial VAP work.
That makes sense for a lot of setups where net80211 is driving radio state
and the radio only cares about the shared state.
However, as noted by a now deleted comment, the ERP and slot time updates
aren't EXACTLY correct/accurate - they only take into account the most
RECENTLY created VAP, and the state updates when one creates/destroys
VAPs isn't exactly great.
So:
* track the short slot logic per VAP;
* whenever the slot time configuration changes, just push it into a deferred
task queue update so drivers don't have to serialise it themselves;
* if a driver registers a per-VAP slot time handler then it'll just get the
per VAP one;
* .. if a driver registers a global one then the legacy behaviour is maintained -
a single slot time is calculated and pushed out.
Note that the calculated slot time is better than the existing logic - if ANY
of the VAPs require long slot then it's disabled for all VAPs rather than
whatever the last configured VAP did.
Now, this isn't entirely complete - the rest of ERP tracking around short/long
slot capable station tracking needs to be converted into per-VAP, as well
as the preamble/barker flags. Luckily those also can be done in a similar
fashion - keep per-VAP counters/flags and unify them before doing the driver
update. I'll defer that work until later.
All the existing drivers can keep doing what they're doing with the global
slot time flags as that is maintained. One driver (iwi) used the per-VAP
flags instead of the ic flags, so now that driver will work properly.
This unblocks some ath10k porting work as the firmware takes the slot time
configuration per-VAP rather than globally, and some firmware handles
STA+AP and STA+STA (on same/different channels) configurations where
the firmware will switch slot time as appropriate.
Tested:
* AR9380, STA/AP mode
* AR9880 (ath10k), STA mode
2020-06-05 06:21:23 +00:00
|
|
|
ieee80211_reset_erp(ic); /* reset global ERP state */
|
2004-12-08 17:26:47 +00:00
|
|
|
|
2003-06-23 16:55:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
* Return the phy mode for with the specified channel.
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
|
|
|
enum ieee80211_phymode
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
ieee80211_chan2mode(const struct ieee80211_channel *chan)
|
2003-06-23 16:55:01 +00:00
|
|
|
{
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
|
2017-01-10 07:50:21 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT_2GHZ(chan))
|
|
|
|
return IEEE80211_MODE_VHT_2GHZ;
|
|
|
|
else if (IEEE80211_IS_CHAN_VHT_5GHZ(chan))
|
|
|
|
return IEEE80211_MODE_VHT_5GHZ;
|
|
|
|
else if (IEEE80211_IS_CHAN_HTA(chan))
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
return IEEE80211_MODE_11NA;
|
|
|
|
else if (IEEE80211_IS_CHAN_HTG(chan))
|
|
|
|
return IEEE80211_MODE_11NG;
|
|
|
|
else if (IEEE80211_IS_CHAN_108G(chan))
|
|
|
|
return IEEE80211_MODE_TURBO_G;
|
|
|
|
else if (IEEE80211_IS_CHAN_ST(chan))
|
|
|
|
return IEEE80211_MODE_STURBO_A;
|
|
|
|
else if (IEEE80211_IS_CHAN_TURBO(chan))
|
2005-12-12 18:38:20 +00:00
|
|
|
return IEEE80211_MODE_TURBO_A;
|
2009-02-19 05:21:54 +00:00
|
|
|
else if (IEEE80211_IS_CHAN_HALF(chan))
|
|
|
|
return IEEE80211_MODE_HALF;
|
|
|
|
else if (IEEE80211_IS_CHAN_QUARTER(chan))
|
|
|
|
return IEEE80211_MODE_QUARTER;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
else if (IEEE80211_IS_CHAN_A(chan))
|
2003-06-23 16:55:01 +00:00
|
|
|
return IEEE80211_MODE_11A;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
else if (IEEE80211_IS_CHAN_ANYG(chan))
|
2003-06-23 16:55:01 +00:00
|
|
|
return IEEE80211_MODE_11G;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
else if (IEEE80211_IS_CHAN_B(chan))
|
2003-06-23 16:55:01 +00:00
|
|
|
return IEEE80211_MODE_11B;
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
else if (IEEE80211_IS_CHAN_FHSS(chan))
|
|
|
|
return IEEE80211_MODE_FH;
|
|
|
|
|
|
|
|
/* NB: should not get here */
|
|
|
|
printf("%s: cannot map channel to mode; freq %u flags 0x%x\n",
|
|
|
|
__func__, chan->ic_freq, chan->ic_flags);
|
|
|
|
return IEEE80211_MODE_11B;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ratemedia {
|
|
|
|
u_int match; /* rate + mode */
|
|
|
|
u_int media; /* if_media rate */
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
findmedia(const struct ratemedia rates[], int n, u_int match)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
if (rates[i].match == match)
|
|
|
|
return rates[i].media;
|
|
|
|
return IFM_AUTO;
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
* Convert IEEE80211 rate value to ifmedia subtype.
|
|
|
|
* Rate is either a legacy rate in units of 0.5Mbps
|
|
|
|
* or an MCS index.
|
2003-06-23 16:55:01 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode mode)
|
|
|
|
{
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
static const struct ratemedia rates[] = {
|
2004-01-15 08:44:27 +00:00
|
|
|
{ 2 | IFM_IEEE80211_FH, IFM_IEEE80211_FH1 },
|
|
|
|
{ 4 | IFM_IEEE80211_FH, IFM_IEEE80211_FH2 },
|
|
|
|
{ 2 | IFM_IEEE80211_11B, IFM_IEEE80211_DS1 },
|
|
|
|
{ 4 | IFM_IEEE80211_11B, IFM_IEEE80211_DS2 },
|
|
|
|
{ 11 | IFM_IEEE80211_11B, IFM_IEEE80211_DS5 },
|
|
|
|
{ 22 | IFM_IEEE80211_11B, IFM_IEEE80211_DS11 },
|
|
|
|
{ 44 | IFM_IEEE80211_11B, IFM_IEEE80211_DS22 },
|
|
|
|
{ 12 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM6 },
|
|
|
|
{ 18 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM9 },
|
|
|
|
{ 24 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM12 },
|
|
|
|
{ 36 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM18 },
|
|
|
|
{ 48 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM24 },
|
|
|
|
{ 72 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM36 },
|
|
|
|
{ 96 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM48 },
|
|
|
|
{ 108 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM54 },
|
|
|
|
{ 2 | IFM_IEEE80211_11G, IFM_IEEE80211_DS1 },
|
|
|
|
{ 4 | IFM_IEEE80211_11G, IFM_IEEE80211_DS2 },
|
|
|
|
{ 11 | IFM_IEEE80211_11G, IFM_IEEE80211_DS5 },
|
|
|
|
{ 22 | IFM_IEEE80211_11G, IFM_IEEE80211_DS11 },
|
|
|
|
{ 12 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM6 },
|
|
|
|
{ 18 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM9 },
|
|
|
|
{ 24 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM12 },
|
|
|
|
{ 36 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM18 },
|
|
|
|
{ 48 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM24 },
|
|
|
|
{ 72 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM36 },
|
|
|
|
{ 96 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM48 },
|
|
|
|
{ 108 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM54 },
|
2006-12-27 18:46:18 +00:00
|
|
|
{ 6 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM3 },
|
|
|
|
{ 9 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM4 },
|
|
|
|
{ 54 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM27 },
|
2016-05-03 18:05:43 +00:00
|
|
|
/* NB: OFDM72 doesn't really exist so we don't handle it */
|
2003-06-23 16:55:01 +00:00
|
|
|
};
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
static const struct ratemedia htrates[] = {
|
|
|
|
{ 0, IFM_IEEE80211_MCS },
|
|
|
|
{ 1, IFM_IEEE80211_MCS },
|
|
|
|
{ 2, IFM_IEEE80211_MCS },
|
|
|
|
{ 3, IFM_IEEE80211_MCS },
|
|
|
|
{ 4, IFM_IEEE80211_MCS },
|
|
|
|
{ 5, IFM_IEEE80211_MCS },
|
|
|
|
{ 6, IFM_IEEE80211_MCS },
|
|
|
|
{ 7, IFM_IEEE80211_MCS },
|
|
|
|
{ 8, IFM_IEEE80211_MCS },
|
|
|
|
{ 9, IFM_IEEE80211_MCS },
|
|
|
|
{ 10, IFM_IEEE80211_MCS },
|
|
|
|
{ 11, IFM_IEEE80211_MCS },
|
|
|
|
{ 12, IFM_IEEE80211_MCS },
|
|
|
|
{ 13, IFM_IEEE80211_MCS },
|
|
|
|
{ 14, IFM_IEEE80211_MCS },
|
|
|
|
{ 15, IFM_IEEE80211_MCS },
|
2011-03-10 18:17:24 +00:00
|
|
|
{ 16, IFM_IEEE80211_MCS },
|
|
|
|
{ 17, IFM_IEEE80211_MCS },
|
|
|
|
{ 18, IFM_IEEE80211_MCS },
|
|
|
|
{ 19, IFM_IEEE80211_MCS },
|
|
|
|
{ 20, IFM_IEEE80211_MCS },
|
|
|
|
{ 21, IFM_IEEE80211_MCS },
|
|
|
|
{ 22, IFM_IEEE80211_MCS },
|
|
|
|
{ 23, IFM_IEEE80211_MCS },
|
|
|
|
{ 24, IFM_IEEE80211_MCS },
|
|
|
|
{ 25, IFM_IEEE80211_MCS },
|
|
|
|
{ 26, IFM_IEEE80211_MCS },
|
|
|
|
{ 27, IFM_IEEE80211_MCS },
|
|
|
|
{ 28, IFM_IEEE80211_MCS },
|
|
|
|
{ 29, IFM_IEEE80211_MCS },
|
|
|
|
{ 30, IFM_IEEE80211_MCS },
|
|
|
|
{ 31, IFM_IEEE80211_MCS },
|
|
|
|
{ 32, IFM_IEEE80211_MCS },
|
|
|
|
{ 33, IFM_IEEE80211_MCS },
|
|
|
|
{ 34, IFM_IEEE80211_MCS },
|
|
|
|
{ 35, IFM_IEEE80211_MCS },
|
|
|
|
{ 36, IFM_IEEE80211_MCS },
|
|
|
|
{ 37, IFM_IEEE80211_MCS },
|
|
|
|
{ 38, IFM_IEEE80211_MCS },
|
|
|
|
{ 39, IFM_IEEE80211_MCS },
|
|
|
|
{ 40, IFM_IEEE80211_MCS },
|
|
|
|
{ 41, IFM_IEEE80211_MCS },
|
|
|
|
{ 42, IFM_IEEE80211_MCS },
|
|
|
|
{ 43, IFM_IEEE80211_MCS },
|
|
|
|
{ 44, IFM_IEEE80211_MCS },
|
|
|
|
{ 45, IFM_IEEE80211_MCS },
|
|
|
|
{ 46, IFM_IEEE80211_MCS },
|
|
|
|
{ 47, IFM_IEEE80211_MCS },
|
|
|
|
{ 48, IFM_IEEE80211_MCS },
|
|
|
|
{ 49, IFM_IEEE80211_MCS },
|
|
|
|
{ 50, IFM_IEEE80211_MCS },
|
|
|
|
{ 51, IFM_IEEE80211_MCS },
|
|
|
|
{ 52, IFM_IEEE80211_MCS },
|
|
|
|
{ 53, IFM_IEEE80211_MCS },
|
|
|
|
{ 54, IFM_IEEE80211_MCS },
|
|
|
|
{ 55, IFM_IEEE80211_MCS },
|
|
|
|
{ 56, IFM_IEEE80211_MCS },
|
|
|
|
{ 57, IFM_IEEE80211_MCS },
|
|
|
|
{ 58, IFM_IEEE80211_MCS },
|
|
|
|
{ 59, IFM_IEEE80211_MCS },
|
|
|
|
{ 60, IFM_IEEE80211_MCS },
|
|
|
|
{ 61, IFM_IEEE80211_MCS },
|
|
|
|
{ 62, IFM_IEEE80211_MCS },
|
|
|
|
{ 63, IFM_IEEE80211_MCS },
|
|
|
|
{ 64, IFM_IEEE80211_MCS },
|
|
|
|
{ 65, IFM_IEEE80211_MCS },
|
|
|
|
{ 66, IFM_IEEE80211_MCS },
|
|
|
|
{ 67, IFM_IEEE80211_MCS },
|
|
|
|
{ 68, IFM_IEEE80211_MCS },
|
|
|
|
{ 69, IFM_IEEE80211_MCS },
|
|
|
|
{ 70, IFM_IEEE80211_MCS },
|
|
|
|
{ 71, IFM_IEEE80211_MCS },
|
|
|
|
{ 72, IFM_IEEE80211_MCS },
|
|
|
|
{ 73, IFM_IEEE80211_MCS },
|
|
|
|
{ 74, IFM_IEEE80211_MCS },
|
|
|
|
{ 75, IFM_IEEE80211_MCS },
|
|
|
|
{ 76, IFM_IEEE80211_MCS },
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
};
|
2020-08-23 21:42:23 +00:00
|
|
|
static const struct ratemedia vhtrates[] = {
|
|
|
|
{ 0, IFM_IEEE80211_VHT },
|
|
|
|
{ 1, IFM_IEEE80211_VHT },
|
|
|
|
{ 2, IFM_IEEE80211_VHT },
|
|
|
|
{ 3, IFM_IEEE80211_VHT },
|
|
|
|
{ 4, IFM_IEEE80211_VHT },
|
|
|
|
{ 5, IFM_IEEE80211_VHT },
|
|
|
|
{ 6, IFM_IEEE80211_VHT },
|
|
|
|
{ 7, IFM_IEEE80211_VHT },
|
|
|
|
{ 8, IFM_IEEE80211_VHT }, /* Optional. */
|
|
|
|
{ 9, IFM_IEEE80211_VHT }, /* Optional. */
|
|
|
|
#if 0
|
|
|
|
/* Some QCA and BRCM seem to support this; offspec. */
|
|
|
|
{ 10, IFM_IEEE80211_VHT },
|
|
|
|
{ 11, IFM_IEEE80211_VHT },
|
|
|
|
#endif
|
|
|
|
};
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
int m;
|
2003-06-23 16:55:01 +00:00
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/*
|
2020-08-23 21:42:23 +00:00
|
|
|
* Check 11ac/11n rates first for match as an MCS.
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
*/
|
2020-08-23 21:42:23 +00:00
|
|
|
if (mode == IEEE80211_MODE_VHT_5GHZ) {
|
|
|
|
if (rate & IFM_IEEE80211_VHT) {
|
|
|
|
rate &= ~IFM_IEEE80211_VHT;
|
|
|
|
m = findmedia(vhtrates, nitems(vhtrates), rate);
|
|
|
|
if (m != IFM_AUTO)
|
|
|
|
return (m | IFM_IEEE80211_VHT);
|
|
|
|
}
|
|
|
|
} else if (mode == IEEE80211_MODE_11NA) {
|
2007-09-18 20:46:36 +00:00
|
|
|
if (rate & IEEE80211_RATE_MCS) {
|
|
|
|
rate &= ~IEEE80211_RATE_MCS;
|
2013-08-14 04:24:25 +00:00
|
|
|
m = findmedia(htrates, nitems(htrates), rate);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
if (m != IFM_AUTO)
|
|
|
|
return m | IFM_IEEE80211_11NA;
|
|
|
|
}
|
|
|
|
} else if (mode == IEEE80211_MODE_11NG) {
|
|
|
|
/* NB: 12 is ambiguous, it will be treated as an MCS */
|
2007-09-18 20:46:36 +00:00
|
|
|
if (rate & IEEE80211_RATE_MCS) {
|
|
|
|
rate &= ~IEEE80211_RATE_MCS;
|
2013-08-14 04:24:25 +00:00
|
|
|
m = findmedia(htrates, nitems(htrates), rate);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
if (m != IFM_AUTO)
|
|
|
|
return m | IFM_IEEE80211_11NG;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rate &= IEEE80211_RATE_VAL;
|
2003-06-23 16:55:01 +00:00
|
|
|
switch (mode) {
|
|
|
|
case IEEE80211_MODE_11A:
|
2009-02-19 05:21:54 +00:00
|
|
|
case IEEE80211_MODE_HALF: /* XXX good 'nuf */
|
|
|
|
case IEEE80211_MODE_QUARTER:
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
case IEEE80211_MODE_11NA:
|
2004-12-08 17:26:47 +00:00
|
|
|
case IEEE80211_MODE_TURBO_A:
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
case IEEE80211_MODE_STURBO_A:
|
2018-07-10 23:30:19 +00:00
|
|
|
return findmedia(rates, nitems(rates),
|
2013-08-14 04:24:25 +00:00
|
|
|
rate | IFM_IEEE80211_11A);
|
2003-06-23 16:55:01 +00:00
|
|
|
case IEEE80211_MODE_11B:
|
2018-07-10 23:30:19 +00:00
|
|
|
return findmedia(rates, nitems(rates),
|
2013-08-14 04:24:25 +00:00
|
|
|
rate | IFM_IEEE80211_11B);
|
2004-01-15 08:44:27 +00:00
|
|
|
case IEEE80211_MODE_FH:
|
2018-07-10 23:30:19 +00:00
|
|
|
return findmedia(rates, nitems(rates),
|
2013-08-14 04:24:25 +00:00
|
|
|
rate | IFM_IEEE80211_FH);
|
2003-06-23 16:55:01 +00:00
|
|
|
case IEEE80211_MODE_AUTO:
|
|
|
|
/* NB: ic may be NULL for some drivers */
|
2009-02-19 04:34:22 +00:00
|
|
|
if (ic != NULL && ic->ic_phytype == IEEE80211_T_FH)
|
2013-08-14 04:24:25 +00:00
|
|
|
return findmedia(rates, nitems(rates),
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
rate | IFM_IEEE80211_FH);
|
2003-06-23 16:55:01 +00:00
|
|
|
/* NB: hack, 11g matches both 11b+11a rates */
|
|
|
|
/* fall thru... */
|
|
|
|
case IEEE80211_MODE_11G:
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
case IEEE80211_MODE_11NG:
|
2004-12-08 17:26:47 +00:00
|
|
|
case IEEE80211_MODE_TURBO_G:
|
2013-08-14 04:24:25 +00:00
|
|
|
return findmedia(rates, nitems(rates), rate | IFM_IEEE80211_11G);
|
2016-12-16 04:44:14 +00:00
|
|
|
case IEEE80211_MODE_VHT_2GHZ:
|
|
|
|
case IEEE80211_MODE_VHT_5GHZ:
|
|
|
|
/* XXX TODO: need to figure out mapping for VHT rates */
|
|
|
|
return IFM_AUTO;
|
2003-06-23 16:55:01 +00:00
|
|
|
}
|
|
|
|
return IFM_AUTO;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ieee80211_media2rate(int mword)
|
|
|
|
{
|
|
|
|
static const int ieeerates[] = {
|
|
|
|
-1, /* IFM_AUTO */
|
|
|
|
0, /* IFM_MANUAL */
|
|
|
|
0, /* IFM_NONE */
|
|
|
|
2, /* IFM_IEEE80211_FH1 */
|
|
|
|
4, /* IFM_IEEE80211_FH2 */
|
|
|
|
2, /* IFM_IEEE80211_DS1 */
|
|
|
|
4, /* IFM_IEEE80211_DS2 */
|
|
|
|
11, /* IFM_IEEE80211_DS5 */
|
|
|
|
22, /* IFM_IEEE80211_DS11 */
|
|
|
|
44, /* IFM_IEEE80211_DS22 */
|
|
|
|
12, /* IFM_IEEE80211_OFDM6 */
|
|
|
|
18, /* IFM_IEEE80211_OFDM9 */
|
|
|
|
24, /* IFM_IEEE80211_OFDM12 */
|
|
|
|
36, /* IFM_IEEE80211_OFDM18 */
|
|
|
|
48, /* IFM_IEEE80211_OFDM24 */
|
|
|
|
72, /* IFM_IEEE80211_OFDM36 */
|
|
|
|
96, /* IFM_IEEE80211_OFDM48 */
|
|
|
|
108, /* IFM_IEEE80211_OFDM54 */
|
|
|
|
144, /* IFM_IEEE80211_OFDM72 */
|
2006-12-27 18:46:18 +00:00
|
|
|
0, /* IFM_IEEE80211_DS354k */
|
|
|
|
0, /* IFM_IEEE80211_DS512k */
|
|
|
|
6, /* IFM_IEEE80211_OFDM3 */
|
|
|
|
9, /* IFM_IEEE80211_OFDM4 */
|
|
|
|
54, /* IFM_IEEE80211_OFDM27 */
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
-1, /* IFM_IEEE80211_MCS */
|
2016-12-16 04:44:14 +00:00
|
|
|
-1, /* IFM_IEEE80211_VHT */
|
2003-06-23 16:55:01 +00:00
|
|
|
};
|
2013-08-14 04:24:25 +00:00
|
|
|
return IFM_SUBTYPE(mword) < nitems(ieeerates) ?
|
2003-06-23 16:55:01 +00:00
|
|
|
ieeerates[IFM_SUBTYPE(mword)] : 0;
|
|
|
|
}
|
2009-07-05 18:17:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The following hash function is adapted from "Hash Functions" by Bob Jenkins
|
|
|
|
* ("Algorithm Alley", Dr. Dobbs Journal, September 1997).
|
|
|
|
*/
|
|
|
|
#define mix(a, b, c) \
|
|
|
|
do { \
|
|
|
|
a -= b; a -= c; a ^= (c >> 13); \
|
|
|
|
b -= c; b -= a; b ^= (a << 8); \
|
|
|
|
c -= a; c -= b; c ^= (b >> 13); \
|
|
|
|
a -= b; a -= c; a ^= (c >> 12); \
|
|
|
|
b -= c; b -= a; b ^= (a << 16); \
|
|
|
|
c -= a; c -= b; c ^= (b >> 5); \
|
|
|
|
a -= b; a -= c; a ^= (c >> 3); \
|
|
|
|
b -= c; b -= a; b ^= (a << 10); \
|
|
|
|
c -= a; c -= b; c ^= (b >> 15); \
|
|
|
|
} while (/*CONSTCOND*/0)
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
ieee80211_mac_hash(const struct ieee80211com *ic,
|
|
|
|
const uint8_t addr[IEEE80211_ADDR_LEN])
|
|
|
|
{
|
|
|
|
uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = ic->ic_hash_key;
|
|
|
|
|
|
|
|
b += addr[5] << 8;
|
|
|
|
b += addr[4];
|
|
|
|
a += addr[3] << 24;
|
|
|
|
a += addr[2] << 16;
|
|
|
|
a += addr[1] << 8;
|
|
|
|
a += addr[0];
|
|
|
|
|
|
|
|
mix(a, b, c);
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
#undef mix
|
2015-01-06 18:25:10 +00:00
|
|
|
|
|
|
|
char
|
|
|
|
ieee80211_channel_type_char(const struct ieee80211_channel *c)
|
|
|
|
{
|
|
|
|
if (IEEE80211_IS_CHAN_ST(c))
|
|
|
|
return 'S';
|
|
|
|
if (IEEE80211_IS_CHAN_108A(c))
|
|
|
|
return 'T';
|
|
|
|
if (IEEE80211_IS_CHAN_108G(c))
|
|
|
|
return 'G';
|
2016-12-16 04:44:14 +00:00
|
|
|
if (IEEE80211_IS_CHAN_VHT(c))
|
|
|
|
return 'v';
|
2015-01-06 18:25:10 +00:00
|
|
|
if (IEEE80211_IS_CHAN_HT(c))
|
|
|
|
return 'n';
|
|
|
|
if (IEEE80211_IS_CHAN_A(c))
|
|
|
|
return 'a';
|
|
|
|
if (IEEE80211_IS_CHAN_ANYG(c))
|
|
|
|
return 'g';
|
|
|
|
if (IEEE80211_IS_CHAN_B(c))
|
|
|
|
return 'b';
|
|
|
|
return 'f';
|
|
|
|
}
|