2004-12-08 17:26:47 +00:00
|
|
|
/*-
|
2008-04-20 20:35:46 +00:00
|
|
|
* Copyright (c) 2003-2008 Sam Leffler, Errno Consulting
|
2004-12-08 17:26:47 +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
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
#ifndef _NET80211_IEEE80211_FREEBSD_H_
|
|
|
|
#define _NET80211_IEEE80211_FREEBSD_H_
|
|
|
|
|
2007-01-09 04:37:05 +00:00
|
|
|
#ifdef _KERNEL
|
2008-04-20 20:35:46 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/mutex.h>
|
|
|
|
#include <sys/rwlock.h>
|
2009-05-02 15:14:18 +00:00
|
|
|
#include <sys/taskqueue.h>
|
2008-04-20 20:35:46 +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 state locking definitions.
|
|
|
|
*/
|
2008-05-28 23:10:53 +00:00
|
|
|
typedef struct {
|
|
|
|
char name[16]; /* e.g. "ath0_com_lock" */
|
|
|
|
struct mtx mtx;
|
|
|
|
} ieee80211_com_lock_t;
|
|
|
|
#define IEEE80211_LOCK_INIT(_ic, _name) do { \
|
|
|
|
ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \
|
|
|
|
snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \
|
|
|
|
mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE); \
|
|
|
|
} while (0)
|
|
|
|
#define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx)
|
|
|
|
#define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic))
|
|
|
|
#define IEEE80211_LOCK(_ic) mtx_lock(IEEE80211_LOCK_OBJ(_ic))
|
|
|
|
#define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_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
|
|
|
#define IEEE80211_LOCK_ASSERT(_ic) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
|
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
|
|
|
|
2004-12-08 17:26:47 +00:00
|
|
|
/*
|
|
|
|
* Node locking definitions.
|
|
|
|
*/
|
2008-04-20 20:35:46 +00:00
|
|
|
typedef struct {
|
|
|
|
char name[16]; /* e.g. "ath0_node_lock" */
|
|
|
|
struct mtx mtx;
|
|
|
|
} ieee80211_node_lock_t;
|
|
|
|
#define IEEE80211_NODE_LOCK_INIT(_nt, _name) do { \
|
|
|
|
ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock; \
|
|
|
|
snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name); \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE); \
|
2008-04-20 20:35:46 +00:00
|
|
|
} while (0)
|
2008-05-28 23:10:53 +00:00
|
|
|
#define IEEE80211_NODE_LOCK_OBJ(_nt) (&(_nt)->nt_nodelock.mtx)
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_LOCK_DESTROY(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_LOCK(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_IS_LOCKED(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_UNLOCK(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_LOCK_ASSERT(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED)
|
2004-12-08 17:26:47 +00:00
|
|
|
|
|
|
|
/*
|
2008-04-20 20:35:46 +00:00
|
|
|
* Node table iteration locking definitions; this protects the
|
|
|
|
* scan generation # used to iterate over the station table
|
|
|
|
* while grabbing+releasing the node lock.
|
2004-12-08 17:26:47 +00:00
|
|
|
*/
|
2008-04-20 20:35:46 +00:00
|
|
|
typedef struct {
|
|
|
|
char name[16]; /* e.g. "ath0_scan_lock" */
|
|
|
|
struct mtx mtx;
|
|
|
|
} ieee80211_scan_lock_t;
|
|
|
|
#define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \
|
|
|
|
ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \
|
|
|
|
snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF); \
|
2008-04-20 20:35:46 +00:00
|
|
|
} while (0)
|
2008-05-28 23:10:53 +00:00
|
|
|
#define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.mtx)
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_ITERATE_LOCK(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
#define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \
|
2008-05-28 23:10:53 +00:00
|
|
|
mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
#define _AGEQ_ENQUEUE(_ifq, _m, _qlen, _age) do { \
|
|
|
|
(_m)->m_nextpkt = NULL; \
|
|
|
|
if ((_ifq)->ifq_tail != NULL) { \
|
2008-09-06 17:04:44 +00:00
|
|
|
_age -= M_AGE_GET((_ifq)->ifq_head); \
|
2008-04-20 20:35:46 +00:00
|
|
|
(_ifq)->ifq_tail->m_nextpkt = (_m); \
|
|
|
|
} else { \
|
|
|
|
(_ifq)->ifq_head = (_m); \
|
|
|
|
} \
|
|
|
|
M_AGE_SET(_m, _age); \
|
|
|
|
(_ifq)->ifq_tail = (_m); \
|
|
|
|
(_qlen) = ++(_ifq)->ifq_len; \
|
|
|
|
} while (0)
|
2004-12-08 17:26:47 +00:00
|
|
|
|
|
|
|
/*
|
2008-10-26 01:04:46 +00:00
|
|
|
* Power-save queue definitions.
|
2004-12-08 17:26:47 +00:00
|
|
|
*/
|
2008-10-26 01:04:46 +00:00
|
|
|
typedef struct mtx ieee80211_psq_lock_t;
|
|
|
|
#define IEEE80211_PSQ_INIT(_psq, _name) \
|
|
|
|
mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF);
|
|
|
|
#define IEEE80211_PSQ_DESTROY(_psq) mtx_destroy(&(_psq)->psq_lock)
|
|
|
|
#define IEEE80211_PSQ_LOCK(_psq) mtx_lock(&(_psq)->psq_lock)
|
|
|
|
#define IEEE80211_PSQ_UNLOCK(_psq) mtx_unlock(&(_psq)->psq_lock)
|
2004-12-08 17:26:47 +00:00
|
|
|
|
2007-03-07 04:42:22 +00:00
|
|
|
#ifndef IF_PREPEND_LIST
|
|
|
|
#define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
|
|
|
|
(mtail)->m_nextpkt = (ifq)->ifq_head; \
|
|
|
|
if ((ifq)->ifq_tail == NULL) \
|
|
|
|
(ifq)->ifq_tail = (mtail); \
|
|
|
|
(ifq)->ifq_head = (mhead); \
|
|
|
|
(ifq)->ifq_len += (mcount); \
|
|
|
|
} while (0)
|
|
|
|
#define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
|
|
|
|
IF_LOCK(ifq); \
|
|
|
|
_IF_PREPEND_LIST(ifq, mhead, mtail, mcount); \
|
|
|
|
IF_UNLOCK(ifq); \
|
|
|
|
} while (0)
|
|
|
|
#endif /* IF_PREPEND_LIST */
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
/* XXX temporary */
|
|
|
|
#define IEEE80211_NODE_WDSQ_INIT(_ni, _name) do { \
|
|
|
|
mtx_init(&(_ni)->ni_wdsq.ifq_mtx, _name, "802.11 wds queue", MTX_DEF);\
|
|
|
|
(_ni)->ni_wdsq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE; \
|
|
|
|
} while (0)
|
|
|
|
#define IEEE80211_NODE_WDSQ_DESTROY(_ni) do { \
|
|
|
|
mtx_destroy(&(_ni)->ni_wdsq.ifq_mtx); \
|
|
|
|
} while (0)
|
|
|
|
#define IEEE80211_NODE_WDSQ_QLEN(_ni) _IF_QLEN(&(_ni)->ni_wdsq)
|
|
|
|
#define IEEE80211_NODE_WDSQ_LOCK(_ni) IF_LOCK(&(_ni)->ni_wdsq)
|
|
|
|
#define IEEE80211_NODE_WDSQ_UNLOCK(_ni) IF_UNLOCK(&(_ni)->ni_wdsq)
|
|
|
|
#define _IEEE80211_NODE_WDSQ_DEQUEUE_HEAD(_ni, _m) do { \
|
|
|
|
_IF_DEQUEUE(&(_ni)->ni_wdsq, m); \
|
|
|
|
} while (0)
|
|
|
|
#define _IEEE80211_NODE_WDSQ_ENQUEUE(_ni, _m, _qlen, _age) do { \
|
|
|
|
_AGEQ_ENQUEUE(&ni->ni_wdsq, _m, _qlen, _age); \
|
|
|
|
} while (0)
|
|
|
|
|
2004-12-08 17:26:47 +00:00
|
|
|
/*
|
|
|
|
* 802.1x MAC ACL database locking definitions.
|
|
|
|
*/
|
|
|
|
typedef struct mtx acl_lock_t;
|
|
|
|
#define ACL_LOCK_INIT(_as, _name) \
|
|
|
|
mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF)
|
|
|
|
#define ACL_LOCK_DESTROY(_as) mtx_destroy(&(_as)->as_lock)
|
|
|
|
#define ACL_LOCK(_as) mtx_lock(&(_as)->as_lock)
|
|
|
|
#define ACL_UNLOCK(_as) mtx_unlock(&(_as)->as_lock)
|
|
|
|
#define ACL_LOCK_ASSERT(_as) \
|
|
|
|
mtx_assert((&(_as)->as_lock), MA_OWNED)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Node reference counting definitions.
|
|
|
|
*
|
|
|
|
* ieee80211_node_initref initialize the reference count to 1
|
|
|
|
* ieee80211_node_incref add a reference
|
|
|
|
* ieee80211_node_decref remove a reference
|
|
|
|
* ieee80211_node_dectestref remove a reference and return 1 if this
|
|
|
|
* is the last reference, otherwise 0
|
|
|
|
* ieee80211_node_refcnt reference count for printing (only)
|
|
|
|
*/
|
|
|
|
#include <machine/atomic.h>
|
|
|
|
|
|
|
|
#define ieee80211_node_initref(_ni) \
|
|
|
|
do { ((_ni)->ni_refcnt = 1); } while (0)
|
|
|
|
#define ieee80211_node_incref(_ni) \
|
|
|
|
atomic_add_int(&(_ni)->ni_refcnt, 1)
|
|
|
|
#define ieee80211_node_decref(_ni) \
|
|
|
|
atomic_subtract_int(&(_ni)->ni_refcnt, 1)
|
|
|
|
struct ieee80211_node;
|
2005-04-04 04:27:20 +00:00
|
|
|
int ieee80211_node_dectestref(struct ieee80211_node *ni);
|
2004-12-08 17:26:47 +00:00
|
|
|
#define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt
|
|
|
|
|
2007-01-09 00:33:10 +00:00
|
|
|
struct ifqueue;
|
2008-04-20 20:35:46 +00:00
|
|
|
struct ieee80211vap;
|
2007-01-08 18:23:43 +00:00
|
|
|
void ieee80211_drain_ifq(struct ifqueue *);
|
2008-04-20 20:35:46 +00:00
|
|
|
void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
|
|
|
|
|
|
|
|
void ieee80211_vap_destroy(struct ieee80211vap *);
|
|
|
|
|
|
|
|
#define IFNET_IS_UP_RUNNING(_ifp) \
|
|
|
|
(((_ifp)->if_flags & IFF_UP) && \
|
|
|
|
((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
|
2007-01-08 18:23:43 +00:00
|
|
|
|
2007-06-25 03:26:10 +00:00
|
|
|
#define msecs_to_ticks(ms) (((ms)*hz)/1000)
|
2008-04-20 20:35:46 +00:00
|
|
|
#define ticks_to_msecs(t) (1000*(t) / hz)
|
|
|
|
#define ticks_to_secs(t) ((t) / hz)
|
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 time_after(a,b) ((long)(b) - (long)(a) < 0)
|
|
|
|
#define time_before(a,b) time_after(b,a)
|
|
|
|
#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
|
|
|
|
#define time_before_eq(a,b) time_after_eq(b,a)
|
|
|
|
|
|
|
|
struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
|
2007-09-05 20:22:59 +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
|
|
|
/* tx path usage */
|
2008-10-26 00:55:38 +00:00
|
|
|
#define M_ENCAP M_PROTO1 /* 802.11 encap done */
|
2008-04-20 20:35:46 +00:00
|
|
|
#define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */
|
2004-12-08 17:26:47 +00:00
|
|
|
#define M_PWR_SAV M_PROTO4 /* bypass PS handling */
|
2005-07-06 01:55:17 +00:00
|
|
|
#define M_MORE_DATA M_PROTO5 /* more data frames to follow */
|
2008-04-20 20:35:46 +00:00
|
|
|
#define M_FF M_PROTO6 /* fast frame */
|
|
|
|
#define M_TXCB M_PROTO7 /* do tx complete callback */
|
2008-09-21 23:00:19 +00:00
|
|
|
#define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */
|
2008-04-20 20:35:46 +00:00
|
|
|
#define M_80211_TX \
|
2009-04-03 18:00:19 +00:00
|
|
|
(M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\
|
2009-02-13 05:26:04 +00:00
|
|
|
M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU)
|
2007-09-05 20:22:59 +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
|
|
|
/* rx path usage */
|
2008-09-21 23:00:19 +00:00
|
|
|
#define M_AMPDU M_PROTO1 /* A-MPDU subframe */
|
2007-09-05 20:22:59 +00:00
|
|
|
#define M_WEP M_PROTO2 /* WEP done by hardware */
|
2008-09-21 23:00:19 +00:00
|
|
|
#if 0
|
|
|
|
#define M_AMPDU_MPDU M_PROTO8 /* A-MPDU re-order done */
|
|
|
|
#endif
|
|
|
|
#define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU)
|
2004-12-08 17:26:47 +00:00
|
|
|
/*
|
2008-04-20 20:35:46 +00:00
|
|
|
* Store WME access control bits in the vlan tag.
|
|
|
|
* This is safe since it's done after the packet is classified
|
|
|
|
* (where we use any previous tag) and because it's passed
|
|
|
|
* directly in to the driver and there's no chance someone
|
|
|
|
* else will clobber them on us.
|
2004-12-08 17:26:47 +00:00
|
|
|
*/
|
|
|
|
#define M_WME_SETAC(m, ac) \
|
2008-04-20 20:35:46 +00:00
|
|
|
((m)->m_pkthdr.ether_vtag = (ac))
|
|
|
|
#define M_WME_GETAC(m) ((m)->m_pkthdr.ether_vtag)
|
2004-12-08 17:26:47 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Mbufs on the power save queue are tagged with an age and
|
|
|
|
* timed out. We reuse the hardware checksum field in the
|
|
|
|
* mbuf packet header to store this data.
|
|
|
|
*/
|
|
|
|
#define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v)
|
|
|
|
#define M_AGE_GET(m) (m->m_pkthdr.csum_data)
|
|
|
|
#define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj)
|
|
|
|
|
2009-04-27 17:39:41 +00:00
|
|
|
/*
|
|
|
|
* Store the sequence number.
|
|
|
|
*/
|
|
|
|
#define M_SEQNO_SET(m, seqno) \
|
|
|
|
((m)->m_pkthdr.tso_segsz = (seqno))
|
|
|
|
#define M_SEQNO_GET(m) ((m)->m_pkthdr.tso_segsz)
|
|
|
|
|
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 MTAG_ABI_NET80211 1132948340 /* net80211 ABI */
|
|
|
|
|
|
|
|
struct ieee80211_cb {
|
|
|
|
void (*func)(struct ieee80211_node *, void *, int status);
|
|
|
|
void *arg;
|
|
|
|
};
|
|
|
|
#define NET80211_TAG_CALLBACK 0 /* xmit complete callback */
|
|
|
|
int ieee80211_add_callback(struct mbuf *m,
|
|
|
|
void (*func)(struct ieee80211_node *, void *, int), void *arg);
|
|
|
|
void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
|
|
|
|
|
2005-04-04 04:27:20 +00:00
|
|
|
void get_random_bytes(void *, size_t);
|
2004-12-08 17:26:47 +00:00
|
|
|
|
|
|
|
struct ieee80211com;
|
|
|
|
|
|
|
|
void ieee80211_sysctl_attach(struct ieee80211com *);
|
|
|
|
void ieee80211_sysctl_detach(struct ieee80211com *);
|
2008-04-20 20:35:46 +00:00
|
|
|
void ieee80211_sysctl_vattach(struct ieee80211vap *);
|
|
|
|
void ieee80211_sysctl_vdetach(struct ieee80211vap *);
|
2004-12-08 17:26:47 +00:00
|
|
|
|
|
|
|
void ieee80211_load_module(const char *);
|
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
|
|
|
/*
|
|
|
|
* A "policy module" is an adjunct module to net80211 that provides
|
|
|
|
* functionality that typically includes policy decisions. This
|
|
|
|
* modularity enables extensibility and vendor-supplied functionality.
|
|
|
|
*/
|
|
|
|
#define _IEEE80211_POLICY_MODULE(policy, name, version) \
|
|
|
|
typedef void (*policy##_setup)(int); \
|
|
|
|
SET_DECLARE(policy##_set, policy##_setup); \
|
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-04-20 20:35:46 +00:00
|
|
|
wlan_##name##_modevent(module_t mod, int type, void *unused) \
|
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
|
|
|
policy##_setup * const *iter, f; \
|
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
|
|
|
switch (type) { \
|
|
|
|
case MOD_LOAD: \
|
2008-04-20 20:35:46 +00:00
|
|
|
SET_FOREACH(iter, policy##_set) { \
|
|
|
|
f = (void*) *iter; \
|
|
|
|
f(type); \
|
|
|
|
} \
|
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 0; \
|
|
|
|
case MOD_UNLOAD: \
|
|
|
|
case MOD_QUIESCE: \
|
|
|
|
if (nrefs) { \
|
|
|
|
printf("wlan_##name: still in use (%u dynamic refs)\n",\
|
|
|
|
nrefs); \
|
|
|
|
return EBUSY; \
|
|
|
|
} \
|
2008-04-20 20:35:46 +00:00
|
|
|
if (type == MOD_UNLOAD) { \
|
|
|
|
SET_FOREACH(iter, policy##_set) { \
|
|
|
|
f = (void*) *iter; \
|
|
|
|
f(type); \
|
|
|
|
} \
|
|
|
|
} \
|
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 0; \
|
|
|
|
} \
|
|
|
|
return EINVAL; \
|
|
|
|
} \
|
|
|
|
static moduledata_t name##_mod = { \
|
|
|
|
"wlan_" #name, \
|
2008-04-20 20:35:46 +00:00
|
|
|
wlan_##name##_modevent, \
|
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
|
|
|
0 \
|
|
|
|
}; \
|
|
|
|
DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
|
|
|
|
MODULE_VERSION(wlan_##name, version); \
|
|
|
|
MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)
|
2008-04-20 20:35:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Crypto modules implement cipher support.
|
|
|
|
*/
|
|
|
|
#define IEEE80211_CRYPTO_MODULE(name, version) \
|
|
|
|
_IEEE80211_POLICY_MODULE(crypto, name, version); \
|
|
|
|
static void \
|
|
|
|
name##_modevent(int type) \
|
|
|
|
{ \
|
|
|
|
if (type == MOD_LOAD) \
|
|
|
|
ieee80211_crypto_register(&name); \
|
|
|
|
else \
|
|
|
|
ieee80211_crypto_unregister(&name); \
|
|
|
|
} \
|
|
|
|
TEXT_SET(crypto##_set, name##_modevent)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Scanner modules provide scanning policy.
|
|
|
|
*/
|
|
|
|
#define IEEE80211_SCANNER_MODULE(name, version) \
|
|
|
|
_IEEE80211_POLICY_MODULE(scanner, name, version)
|
|
|
|
|
|
|
|
#define IEEE80211_SCANNER_ALG(name, alg, v) \
|
|
|
|
static void \
|
|
|
|
name##_modevent(int type) \
|
|
|
|
{ \
|
|
|
|
if (type == MOD_LOAD) \
|
|
|
|
ieee80211_scanner_register(alg, &v); \
|
|
|
|
else \
|
|
|
|
ieee80211_scanner_unregister(alg, &v); \
|
|
|
|
} \
|
|
|
|
TEXT_SET(scanner_set, name##_modevent); \
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACL modules implement acl policy.
|
|
|
|
*/
|
|
|
|
#define IEEE80211_ACL_MODULE(name, alg, version) \
|
|
|
|
_IEEE80211_POLICY_MODULE(acl, name, version); \
|
|
|
|
static void \
|
|
|
|
alg##_modevent(int type) \
|
|
|
|
{ \
|
|
|
|
if (type == MOD_LOAD) \
|
|
|
|
ieee80211_aclator_register(&alg); \
|
|
|
|
else \
|
|
|
|
ieee80211_aclator_unregister(&alg); \
|
|
|
|
} \
|
|
|
|
TEXT_SET(acl_set, alg##_modevent); \
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Authenticator modules handle 802.1x/WPA authentication.
|
|
|
|
*/
|
|
|
|
#define IEEE80211_AUTH_MODULE(name, version) \
|
|
|
|
_IEEE80211_POLICY_MODULE(auth, name, version)
|
|
|
|
|
|
|
|
#define IEEE80211_AUTH_ALG(name, alg, v) \
|
|
|
|
static void \
|
|
|
|
name##_modevent(int type) \
|
|
|
|
{ \
|
|
|
|
if (type == MOD_LOAD) \
|
|
|
|
ieee80211_authenticator_register(alg, &v); \
|
|
|
|
else \
|
|
|
|
ieee80211_authenticator_unregister(alg); \
|
|
|
|
} \
|
|
|
|
TEXT_SET(auth_set, name##_modevent)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Rate control modules provide tx rate control support.
|
|
|
|
*/
|
|
|
|
#define IEEE80211_RATE_MODULE(alg, version) \
|
|
|
|
_IEEE80211_POLICY_MODULE(rate, alg, version); \
|
|
|
|
static void \
|
|
|
|
alg##_modevent(int type) \
|
|
|
|
{ \
|
|
|
|
/* XXX nothing to do until the rate control framework arrives */\
|
|
|
|
} \
|
|
|
|
TEXT_SET(rate##_set, alg##_modevent)
|
2004-12-08 17:26:47 +00:00
|
|
|
|
2009-03-24 17:57:48 +00:00
|
|
|
struct ieee80211req;
|
|
|
|
typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,
|
|
|
|
struct ieee80211req *);
|
|
|
|
SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc);
|
|
|
|
#define IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get)
|
|
|
|
|
|
|
|
typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *,
|
|
|
|
struct ieee80211req *);
|
|
|
|
SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);
|
|
|
|
#define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)
|
2009-03-24 21:02:19 +00:00
|
|
|
#endif /* _KERNEL */
|
2009-03-24 17:57:48 +00:00
|
|
|
|
2004-12-08 17:26:47 +00:00
|
|
|
/* XXX this stuff belongs elsewhere */
|
|
|
|
/*
|
|
|
|
* Message formats for messages from the net80211 layer to user
|
|
|
|
* applications via the routing socket. These messages are appended
|
|
|
|
* to an if_announcemsghdr structure.
|
|
|
|
*/
|
|
|
|
struct ieee80211_join_event {
|
|
|
|
uint8_t iev_addr[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_leave_event {
|
|
|
|
uint8_t iev_addr[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_replay_event {
|
|
|
|
uint8_t iev_src[6]; /* src MAC */
|
|
|
|
uint8_t iev_dst[6]; /* dst MAC */
|
|
|
|
uint8_t iev_cipher; /* cipher type */
|
|
|
|
uint8_t iev_keyix; /* key id/index */
|
|
|
|
uint64_t iev_keyrsc; /* RSC from key */
|
|
|
|
uint64_t iev_rsc; /* RSC from frame */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_michael_event {
|
|
|
|
uint8_t iev_src[6]; /* src MAC */
|
|
|
|
uint8_t iev_dst[6]; /* dst MAC */
|
|
|
|
uint8_t iev_cipher; /* cipher type */
|
|
|
|
uint8_t iev_keyix; /* key id/index */
|
|
|
|
};
|
|
|
|
|
2008-04-20 20:35:46 +00:00
|
|
|
struct ieee80211_wds_event {
|
|
|
|
uint8_t iev_addr[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_csa_event {
|
|
|
|
uint32_t iev_flags; /* channel flags */
|
|
|
|
uint16_t iev_freq; /* setting in Mhz */
|
|
|
|
uint8_t iev_ieee; /* IEEE channel number */
|
|
|
|
uint8_t iev_mode; /* CSA mode */
|
|
|
|
uint8_t iev_count; /* CSA count */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_cac_event {
|
|
|
|
uint32_t iev_flags; /* channel flags */
|
|
|
|
uint16_t iev_freq; /* setting in Mhz */
|
|
|
|
uint8_t iev_ieee; /* IEEE channel number */
|
|
|
|
/* XXX timestamp? */
|
|
|
|
uint8_t iev_type; /* IEEE80211_NOTIFY_CAC_* */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_radar_event {
|
|
|
|
uint32_t iev_flags; /* channel flags */
|
|
|
|
uint16_t iev_freq; /* setting in Mhz */
|
|
|
|
uint8_t iev_ieee; /* IEEE channel number */
|
|
|
|
/* XXX timestamp? */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_auth_event {
|
|
|
|
uint8_t iev_addr[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_deauth_event {
|
|
|
|
uint8_t iev_addr[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_country_event {
|
|
|
|
uint8_t iev_addr[6];
|
|
|
|
uint8_t iev_cc[2]; /* ISO country code */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ieee80211_radio_event {
|
|
|
|
uint8_t iev_state; /* 1 on, 0 off */
|
|
|
|
};
|
|
|
|
|
2004-12-08 17:26:47 +00:00
|
|
|
#define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */
|
|
|
|
#define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */
|
|
|
|
#define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */
|
|
|
|
#define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */
|
|
|
|
#define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */
|
|
|
|
#define RTM_IEEE80211_SCAN 105 /* scan complete, results available */
|
|
|
|
#define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */
|
|
|
|
#define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */
|
2005-03-29 19:36:42 +00:00
|
|
|
#define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */
|
2008-04-20 20:35:46 +00:00
|
|
|
#define RTM_IEEE80211_WDS 109 /* WDS discovery (ap mode) */
|
|
|
|
#define RTM_IEEE80211_CSA 110 /* Channel Switch Announcement event */
|
|
|
|
#define RTM_IEEE80211_RADAR 111 /* radar event */
|
|
|
|
#define RTM_IEEE80211_CAC 112 /* Channel Availability Check event */
|
|
|
|
#define RTM_IEEE80211_DEAUTH 113 /* station deauthenticate */
|
|
|
|
#define RTM_IEEE80211_AUTH 114 /* station authenticate (ap mode) */
|
|
|
|
#define RTM_IEEE80211_COUNTRY 115 /* discovered country code (sta mode) */
|
|
|
|
#define RTM_IEEE80211_RADIO 116 /* RF kill switch state change */
|
2004-12-08 17:26:47 +00:00
|
|
|
|
2006-07-26 03:15:16 +00:00
|
|
|
/*
|
|
|
|
* Structure prepended to raw packets sent through the bpf
|
|
|
|
* interface when set to DLT_IEEE802_11_RADIO. This allows
|
|
|
|
* user applications to specify pretty much everything in
|
|
|
|
* an Atheros tx descriptor. XXX need to generalize.
|
|
|
|
*
|
|
|
|
* XXX cannot be more than 14 bytes as it is copied to a sockaddr's
|
|
|
|
* XXX sa_data area.
|
|
|
|
*/
|
|
|
|
struct ieee80211_bpf_params {
|
|
|
|
uint8_t ibp_vers; /* version */
|
|
|
|
#define IEEE80211_BPF_VERSION 0
|
|
|
|
uint8_t ibp_len; /* header length in bytes */
|
|
|
|
uint8_t ibp_flags;
|
|
|
|
#define IEEE80211_BPF_SHORTPRE 0x01 /* tx with short preamble */
|
|
|
|
#define IEEE80211_BPF_NOACK 0x02 /* tx with no ack */
|
|
|
|
#define IEEE80211_BPF_CRYPTO 0x04 /* tx with h/w encryption */
|
|
|
|
#define IEEE80211_BPF_FCS 0x10 /* frame incldues FCS */
|
|
|
|
#define IEEE80211_BPF_DATAPAD 0x20 /* frame includes data padding */
|
|
|
|
#define IEEE80211_BPF_RTS 0x40 /* tx with RTS/CTS */
|
|
|
|
#define IEEE80211_BPF_CTS 0x80 /* tx with CTS only */
|
|
|
|
uint8_t ibp_pri; /* WME/WMM AC+tx antenna */
|
|
|
|
uint8_t ibp_try0; /* series 1 try count */
|
|
|
|
uint8_t ibp_rate0; /* series 1 IEEE tx rate */
|
|
|
|
uint8_t ibp_power; /* tx power (device units) */
|
|
|
|
uint8_t ibp_ctsrate; /* IEEE tx rate for CTS */
|
|
|
|
uint8_t ibp_try1; /* series 2 try count */
|
|
|
|
uint8_t ibp_rate1; /* series 2 IEEE tx rate */
|
|
|
|
uint8_t ibp_try2; /* series 3 try count */
|
|
|
|
uint8_t ibp_rate2; /* series 3 IEEE tx rate */
|
|
|
|
uint8_t ibp_try3; /* series 4 try count */
|
|
|
|
uint8_t ibp_rate3; /* series 4 IEEE tx rate */
|
|
|
|
};
|
2004-12-08 17:26:47 +00:00
|
|
|
#endif /* _NET80211_IEEE80211_FREEBSD_H_ */
|