Home | History | Annotate | Line # | Download | only in net80211
ieee80211_netbsd.h revision 1.21.2.2
      1  1.21.2.2      phil /*	$NetBSD: ieee80211_netbsd.h,v 1.21.2.2 2018/06/28 21:23:01 phil Exp $ */
      2  1.21.2.2      phil 
      3       1.2    dyoung /*-
      4  1.21.2.1      phil  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
      5  1.21.2.1      phil  *
      6  1.21.2.1      phil  * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting
      7       1.2    dyoung  * All rights reserved.
      8       1.2    dyoung  *
      9       1.2    dyoung  * Redistribution and use in source and binary forms, with or without
     10       1.2    dyoung  * modification, are permitted provided that the following conditions
     11       1.2    dyoung  * are met:
     12       1.2    dyoung  * 1. Redistributions of source code must retain the above copyright
     13       1.2    dyoung  *    notice, this list of conditions and the following disclaimer.
     14       1.2    dyoung  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.2    dyoung  *    notice, this list of conditions and the following disclaimer in the
     16       1.2    dyoung  *    documentation and/or other materials provided with the distribution.
     17       1.2    dyoung  *
     18       1.2    dyoung  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19       1.2    dyoung  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20       1.2    dyoung  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21       1.2    dyoung  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22       1.2    dyoung  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23       1.2    dyoung  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24       1.2    dyoung  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25       1.2    dyoung  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26       1.2    dyoung  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27       1.2    dyoung  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28       1.2    dyoung  *
     29  1.21.2.1      phil  * $FreeBSD$
     30       1.2    dyoung  */
     31  1.21.2.1      phil #ifndef _NET80211_IEEE80211_FREEBSD_H_
     32  1.21.2.1      phil #define _NET80211_IEEE80211_FREEBSD_H_
     33       1.2    dyoung 
     34      1.13    dyoung #ifdef _KERNEL
     35  1.21.2.1      phil #include <sys/param.h>
     36  1.21.2.1      phil #include <sys/systm.h>
     37  1.21.2.1      phil #include <sys/counter.h>
     38  1.21.2.1      phil #include <sys/lock.h>
     39  1.21.2.1      phil #include <sys/mutex.h>
     40  1.21.2.1      phil #include <sys/rwlock.h>
     41  1.21.2.1      phil #include <sys/sysctl.h>
     42  1.21.2.1      phil #include <sys/taskqueue.h>
     43  1.21.2.1      phil 
     44  1.21.2.1      phil /*
     45  1.21.2.1      phil  * Common state locking definitions.
     46  1.21.2.1      phil  */
     47  1.21.2.1      phil typedef struct {
     48  1.21.2.1      phil 	char		name[16];		/* e.g. "ath0_com_lock" */
     49  1.21.2.1      phil 	struct mtx	mtx;
     50  1.21.2.1      phil } ieee80211_com_lock_t;
     51  1.21.2.1      phil #define	IEEE80211_LOCK_INIT(_ic, _name) do {				\
     52  1.21.2.1      phil 	ieee80211_com_lock_t *cl = &(_ic)->ic_comlock;			\
     53  1.21.2.1      phil 	snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name);	\
     54  1.21.2.1      phil 	mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE);	\
     55  1.21.2.1      phil } while (0)
     56  1.21.2.1      phil #define	IEEE80211_LOCK_OBJ(_ic)	(&(_ic)->ic_comlock.mtx)
     57  1.21.2.1      phil #define	IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic))
     58  1.21.2.1      phil #define	IEEE80211_LOCK(_ic)	   mtx_lock(IEEE80211_LOCK_OBJ(_ic))
     59  1.21.2.1      phil #define	IEEE80211_UNLOCK(_ic)	   mtx_unlock(IEEE80211_LOCK_OBJ(_ic))
     60  1.21.2.1      phil #define	IEEE80211_LOCK_ASSERT(_ic) \
     61  1.21.2.1      phil 	mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
     62  1.21.2.1      phil #define	IEEE80211_UNLOCK_ASSERT(_ic) \
     63  1.21.2.1      phil 	mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED)
     64  1.21.2.1      phil 
     65  1.21.2.1      phil /*
     66  1.21.2.1      phil  * Transmit lock.
     67  1.21.2.1      phil  *
     68  1.21.2.1      phil  * This is a (mostly) temporary lock designed to serialise all of the
     69  1.21.2.1      phil  * transmission operations throughout the stack.
     70  1.21.2.1      phil  */
     71  1.21.2.1      phil typedef struct {
     72  1.21.2.1      phil 	char		name[16];		/* e.g. "ath0_tx_lock" */
     73  1.21.2.1      phil 	struct mtx	mtx;
     74  1.21.2.1      phil } ieee80211_tx_lock_t;
     75  1.21.2.1      phil #define	IEEE80211_TX_LOCK_INIT(_ic, _name) do {				\
     76  1.21.2.1      phil 	ieee80211_tx_lock_t *cl = &(_ic)->ic_txlock;			\
     77  1.21.2.1      phil 	snprintf(cl->name, sizeof(cl->name), "%s_tx_lock", _name);	\
     78  1.21.2.1      phil 	mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF);	\
     79  1.21.2.1      phil } while (0)
     80  1.21.2.1      phil #define	IEEE80211_TX_LOCK_OBJ(_ic)	(&(_ic)->ic_txlock.mtx)
     81  1.21.2.1      phil #define	IEEE80211_TX_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_TX_LOCK_OBJ(_ic))
     82  1.21.2.1      phil #define	IEEE80211_TX_LOCK(_ic)	   mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic))
     83  1.21.2.1      phil #define	IEEE80211_TX_UNLOCK(_ic)	   mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic))
     84  1.21.2.1      phil #define	IEEE80211_TX_LOCK_ASSERT(_ic) \
     85  1.21.2.1      phil 	mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED)
     86  1.21.2.1      phil #define	IEEE80211_TX_UNLOCK_ASSERT(_ic) \
     87  1.21.2.1      phil 	mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED)
     88  1.21.2.1      phil 
     89  1.21.2.1      phil /*
     90  1.21.2.1      phil  * Stageq / ni_tx_superg lock
     91  1.21.2.1      phil  */
     92  1.21.2.1      phil typedef struct {
     93  1.21.2.1      phil 	char		name[16];		/* e.g. "ath0_ff_lock" */
     94  1.21.2.1      phil 	struct mtx	mtx;
     95  1.21.2.1      phil } ieee80211_ff_lock_t;
     96  1.21.2.1      phil #define IEEE80211_FF_LOCK_INIT(_ic, _name) do {				\
     97  1.21.2.1      phil 	ieee80211_ff_lock_t *fl = &(_ic)->ic_fflock;			\
     98  1.21.2.1      phil 	snprintf(fl->name, sizeof(fl->name), "%s_ff_lock", _name);	\
     99  1.21.2.1      phil 	mtx_init(&fl->mtx, fl->name, NULL, MTX_DEF);			\
    100  1.21.2.1      phil } while (0)
    101  1.21.2.1      phil #define IEEE80211_FF_LOCK_OBJ(_ic)	(&(_ic)->ic_fflock.mtx)
    102  1.21.2.1      phil #define IEEE80211_FF_LOCK_DESTROY(_ic)	mtx_destroy(IEEE80211_FF_LOCK_OBJ(_ic))
    103  1.21.2.1      phil #define IEEE80211_FF_LOCK(_ic)		mtx_lock(IEEE80211_FF_LOCK_OBJ(_ic))
    104  1.21.2.1      phil #define IEEE80211_FF_UNLOCK(_ic)	mtx_unlock(IEEE80211_FF_LOCK_OBJ(_ic))
    105  1.21.2.1      phil #define IEEE80211_FF_LOCK_ASSERT(_ic) \
    106  1.21.2.1      phil 	mtx_assert(IEEE80211_FF_LOCK_OBJ(_ic), MA_OWNED)
    107       1.2    dyoung 
    108       1.2    dyoung /*
    109       1.2    dyoung  * Node locking definitions.
    110       1.2    dyoung  */
    111  1.21.2.1      phil typedef struct {
    112  1.21.2.1      phil 	char		name[16];		/* e.g. "ath0_node_lock" */
    113  1.21.2.1      phil 	struct mtx	mtx;
    114  1.21.2.1      phil } ieee80211_node_lock_t;
    115  1.21.2.1      phil #define	IEEE80211_NODE_LOCK_INIT(_nt, _name) do {			\
    116  1.21.2.1      phil 	ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock;		\
    117  1.21.2.1      phil 	snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name);	\
    118  1.21.2.1      phil 	mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE);	\
    119       1.2    dyoung } while (0)
    120  1.21.2.1      phil #define	IEEE80211_NODE_LOCK_OBJ(_nt)	(&(_nt)->nt_nodelock.mtx)
    121  1.21.2.1      phil #define	IEEE80211_NODE_LOCK_DESTROY(_nt) \
    122  1.21.2.1      phil 	mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt))
    123  1.21.2.1      phil #define	IEEE80211_NODE_LOCK(_nt) \
    124  1.21.2.1      phil 	mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt))
    125  1.21.2.1      phil #define	IEEE80211_NODE_IS_LOCKED(_nt) \
    126  1.21.2.1      phil 	mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt))
    127  1.21.2.1      phil #define	IEEE80211_NODE_UNLOCK(_nt) \
    128  1.21.2.1      phil 	mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt))
    129  1.21.2.1      phil #define	IEEE80211_NODE_LOCK_ASSERT(_nt)	\
    130  1.21.2.1      phil 	mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED)
    131  1.21.2.1      phil 
    132  1.21.2.1      phil /*
    133  1.21.2.1      phil  * Power-save queue definitions.
    134  1.21.2.1      phil  */
    135  1.21.2.1      phil typedef struct mtx ieee80211_psq_lock_t;
    136  1.21.2.1      phil #define	IEEE80211_PSQ_INIT(_psq, _name) \
    137  1.21.2.1      phil 	mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF)
    138  1.21.2.1      phil #define	IEEE80211_PSQ_DESTROY(_psq)	mtx_destroy(&(_psq)->psq_lock)
    139  1.21.2.1      phil #define	IEEE80211_PSQ_LOCK(_psq)	mtx_lock(&(_psq)->psq_lock)
    140  1.21.2.1      phil #define	IEEE80211_PSQ_UNLOCK(_psq)	mtx_unlock(&(_psq)->psq_lock)
    141  1.21.2.1      phil 
    142  1.21.2.1      phil #ifndef IF_PREPEND_LIST
    143  1.21.2.1      phil #define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {	\
    144  1.21.2.1      phil 	(mtail)->m_nextpkt = (ifq)->ifq_head;			\
    145  1.21.2.1      phil 	if ((ifq)->ifq_tail == NULL)				\
    146  1.21.2.1      phil 		(ifq)->ifq_tail = (mtail);			\
    147  1.21.2.1      phil 	(ifq)->ifq_head = (mhead);				\
    148  1.21.2.1      phil 	(ifq)->ifq_len += (mcount);				\
    149  1.21.2.1      phil } while (0)
    150  1.21.2.1      phil #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {		\
    151  1.21.2.1      phil 	IF_LOCK(ifq);						\
    152  1.21.2.1      phil 	_IF_PREPEND_LIST(ifq, mhead, mtail, mcount);		\
    153  1.21.2.1      phil 	IF_UNLOCK(ifq);						\
    154  1.21.2.1      phil } while (0)
    155  1.21.2.1      phil #endif /* IF_PREPEND_LIST */
    156  1.21.2.1      phil 
    157  1.21.2.1      phil /*
    158  1.21.2.1      phil  * Age queue definitions.
    159  1.21.2.1      phil  */
    160  1.21.2.1      phil typedef struct mtx ieee80211_ageq_lock_t;
    161  1.21.2.1      phil #define	IEEE80211_AGEQ_INIT(_aq, _name) \
    162  1.21.2.1      phil 	mtx_init(&(_aq)->aq_lock, _name, "802.11 age q", MTX_DEF)
    163  1.21.2.1      phil #define	IEEE80211_AGEQ_DESTROY(_aq)	mtx_destroy(&(_aq)->aq_lock)
    164  1.21.2.1      phil #define	IEEE80211_AGEQ_LOCK(_aq)	mtx_lock(&(_aq)->aq_lock)
    165  1.21.2.1      phil #define	IEEE80211_AGEQ_UNLOCK(_aq)	mtx_unlock(&(_aq)->aq_lock)
    166       1.2    dyoung 
    167       1.2    dyoung /*
    168       1.2    dyoung  * 802.1x MAC ACL database locking definitions.
    169       1.2    dyoung  */
    170  1.21.2.1      phil typedef struct mtx acl_lock_t;
    171  1.21.2.1      phil #define	ACL_LOCK_INIT(_as, _name) \
    172  1.21.2.1      phil 	mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF)
    173  1.21.2.1      phil #define	ACL_LOCK_DESTROY(_as)		mtx_destroy(&(_as)->as_lock)
    174  1.21.2.1      phil #define	ACL_LOCK(_as)			mtx_lock(&(_as)->as_lock)
    175  1.21.2.1      phil #define	ACL_UNLOCK(_as)			mtx_unlock(&(_as)->as_lock)
    176  1.21.2.1      phil #define	ACL_LOCK_ASSERT(_as) \
    177  1.21.2.1      phil 	mtx_assert((&(_as)->as_lock), MA_OWNED)
    178  1.21.2.1      phil 
    179  1.21.2.1      phil /*
    180  1.21.2.1      phil  * Scan table definitions.
    181  1.21.2.1      phil  */
    182  1.21.2.1      phil typedef struct mtx ieee80211_scan_table_lock_t;
    183  1.21.2.1      phil #define	IEEE80211_SCAN_TABLE_LOCK_INIT(_st, _name) \
    184  1.21.2.1      phil 	mtx_init(&(_st)->st_lock, _name, "802.11 scan table", MTX_DEF)
    185  1.21.2.1      phil #define	IEEE80211_SCAN_TABLE_LOCK_DESTROY(_st)	mtx_destroy(&(_st)->st_lock)
    186  1.21.2.1      phil #define	IEEE80211_SCAN_TABLE_LOCK(_st)		mtx_lock(&(_st)->st_lock)
    187  1.21.2.1      phil #define	IEEE80211_SCAN_TABLE_UNLOCK(_st)	mtx_unlock(&(_st)->st_lock)
    188  1.21.2.1      phil 
    189  1.21.2.1      phil typedef struct mtx ieee80211_scan_iter_lock_t;
    190  1.21.2.1      phil #define	IEEE80211_SCAN_ITER_LOCK_INIT(_st, _name) \
    191  1.21.2.1      phil 	mtx_init(&(_st)->st_scanlock, _name, "802.11 scangen", MTX_DEF)
    192  1.21.2.1      phil #define	IEEE80211_SCAN_ITER_LOCK_DESTROY(_st)	mtx_destroy(&(_st)->st_scanlock)
    193  1.21.2.1      phil #define	IEEE80211_SCAN_ITER_LOCK(_st)		mtx_lock(&(_st)->st_scanlock)
    194  1.21.2.1      phil #define	IEEE80211_SCAN_ITER_UNLOCK(_st)	mtx_unlock(&(_st)->st_scanlock)
    195  1.21.2.1      phil 
    196  1.21.2.1      phil /*
    197  1.21.2.1      phil  * Mesh node/routing definitions.
    198  1.21.2.1      phil  */
    199  1.21.2.1      phil typedef struct mtx ieee80211_rte_lock_t;
    200  1.21.2.1      phil #define	MESH_RT_ENTRY_LOCK_INIT(_rt, _name) \
    201  1.21.2.1      phil 	mtx_init(&(rt)->rt_lock, _name, "802.11s route entry", MTX_DEF)
    202  1.21.2.1      phil #define	MESH_RT_ENTRY_LOCK_DESTROY(_rt) \
    203  1.21.2.1      phil 	mtx_destroy(&(_rt)->rt_lock)
    204  1.21.2.1      phil #define	MESH_RT_ENTRY_LOCK(rt)	mtx_lock(&(rt)->rt_lock)
    205  1.21.2.1      phil #define	MESH_RT_ENTRY_LOCK_ASSERT(rt) mtx_assert(&(rt)->rt_lock, MA_OWNED)
    206  1.21.2.1      phil #define	MESH_RT_ENTRY_UNLOCK(rt)	mtx_unlock(&(rt)->rt_lock)
    207  1.21.2.1      phil 
    208  1.21.2.1      phil typedef struct mtx ieee80211_rt_lock_t;
    209  1.21.2.1      phil #define	MESH_RT_LOCK(ms)	mtx_lock(&(ms)->ms_rt_lock)
    210  1.21.2.1      phil #define	MESH_RT_LOCK_ASSERT(ms)	mtx_assert(&(ms)->ms_rt_lock, MA_OWNED)
    211  1.21.2.1      phil #define	MESH_RT_UNLOCK(ms)	mtx_unlock(&(ms)->ms_rt_lock)
    212  1.21.2.1      phil #define	MESH_RT_LOCK_INIT(ms, name) \
    213  1.21.2.1      phil 	mtx_init(&(ms)->ms_rt_lock, name, "802.11s routing table", MTX_DEF)
    214  1.21.2.1      phil #define	MESH_RT_LOCK_DESTROY(ms) \
    215  1.21.2.1      phil 	mtx_destroy(&(ms)->ms_rt_lock)
    216  1.21.2.1      phil 
    217  1.21.2.1      phil /*
    218  1.21.2.1      phil  * Node reference counting definitions.
    219  1.21.2.1      phil  *
    220  1.21.2.1      phil  * ieee80211_node_initref	initialize the reference count to 1
    221  1.21.2.1      phil  * ieee80211_node_incref	add a reference
    222  1.21.2.1      phil  * ieee80211_node_decref	remove a reference
    223  1.21.2.1      phil  * ieee80211_node_dectestref	remove a reference and return 1 if this
    224  1.21.2.1      phil  *				is the last reference, otherwise 0
    225  1.21.2.1      phil  * ieee80211_node_refcnt	reference count for printing (only)
    226  1.21.2.1      phil  */
    227  1.21.2.1      phil #include <machine/atomic.h>
    228  1.21.2.1      phil 
    229  1.21.2.1      phil #define ieee80211_node_initref(_ni) \
    230  1.21.2.1      phil 	do { ((_ni)->ni_refcnt = 1); } while (0)
    231  1.21.2.1      phil #define ieee80211_node_incref(_ni) \
    232  1.21.2.1      phil 	atomic_add_int(&(_ni)->ni_refcnt, 1)
    233  1.21.2.1      phil #define	ieee80211_node_decref(_ni) \
    234  1.21.2.1      phil 	atomic_subtract_int(&(_ni)->ni_refcnt, 1)
    235  1.21.2.1      phil struct ieee80211_node;
    236  1.21.2.1      phil int	ieee80211_node_dectestref(struct ieee80211_node *ni);
    237  1.21.2.1      phil #define	ieee80211_node_refcnt(_ni)	(_ni)->ni_refcnt
    238       1.2    dyoung 
    239      1.12  degroote struct ifqueue;
    240  1.21.2.1      phil struct ieee80211vap;
    241      1.12  degroote void	ieee80211_drain_ifq(struct ifqueue *);
    242  1.21.2.1      phil void	ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
    243  1.21.2.1      phil 
    244  1.21.2.1      phil void	ieee80211_vap_destroy(struct ieee80211vap *);
    245  1.21.2.1      phil 
    246  1.21.2.1      phil #define	IFNET_IS_UP_RUNNING(_ifp) \
    247  1.21.2.1      phil 	(((_ifp)->if_flags & IFF_UP) && \
    248  1.21.2.1      phil 	 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
    249  1.21.2.1      phil 
    250  1.21.2.1      phil /* XXX TODO: cap these at 1, as hz may not be 1000 */
    251  1.21.2.1      phil #define	msecs_to_ticks(ms)	(((ms)*hz)/1000)
    252  1.21.2.1      phil #define	ticks_to_msecs(t)	(1000*(t) / hz)
    253  1.21.2.1      phil #define	ticks_to_secs(t)	((t) / hz)
    254  1.21.2.1      phil 
    255  1.21.2.1      phil #define ieee80211_time_after(a,b) 	((long)(b) - (long)(a) < 0)
    256  1.21.2.1      phil #define ieee80211_time_before(a,b)	ieee80211_time_after(b,a)
    257  1.21.2.1      phil #define ieee80211_time_after_eq(a,b)	((long)(a) - (long)(b) >= 0)
    258  1.21.2.1      phil #define ieee80211_time_before_eq(a,b)	ieee80211_time_after_eq(b,a)
    259  1.21.2.1      phil 
    260  1.21.2.1      phil struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
    261  1.21.2.1      phil 
    262  1.21.2.1      phil /* tx path usage */
    263  1.21.2.1      phil #define	M_ENCAP		M_PROTO1		/* 802.11 encap done */
    264  1.21.2.1      phil #define	M_EAPOL		M_PROTO3		/* PAE/EAPOL frame */
    265  1.21.2.1      phil #define	M_PWR_SAV	M_PROTO4		/* bypass PS handling */
    266  1.21.2.1      phil #define	M_MORE_DATA	M_PROTO5		/* more data frames to follow */
    267  1.21.2.1      phil #define	M_FF		M_PROTO6		/* fast frame / A-MSDU */
    268  1.21.2.1      phil #define	M_TXCB		M_PROTO7		/* do tx complete callback */
    269  1.21.2.1      phil #define	M_AMPDU_MPDU	M_PROTO8		/* ok for A-MPDU aggregation */
    270  1.21.2.1      phil #define	M_FRAG		M_PROTO9		/* frame fragmentation */
    271  1.21.2.1      phil #define	M_FIRSTFRAG	M_PROTO10		/* first frame fragment */
    272  1.21.2.1      phil #define	M_LASTFRAG	M_PROTO11		/* last frame fragment */
    273  1.21.2.1      phil 
    274  1.21.2.1      phil #define	M_80211_TX \
    275  1.21.2.1      phil 	(M_ENCAP|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB| \
    276  1.21.2.1      phil 	 M_AMPDU_MPDU|M_FRAG|M_FIRSTFRAG|M_LASTFRAG)
    277  1.21.2.1      phil 
    278  1.21.2.1      phil /* rx path usage */
    279  1.21.2.1      phil #define	M_AMPDU		M_PROTO1		/* A-MPDU subframe */
    280  1.21.2.1      phil #define	M_WEP		M_PROTO2		/* WEP done by hardware */
    281  1.21.2.1      phil #if 0
    282  1.21.2.1      phil #define	M_AMPDU_MPDU	M_PROTO8		/* A-MPDU re-order done */
    283  1.21.2.1      phil #endif
    284  1.21.2.1      phil #define	M_80211_RX	(M_AMPDU|M_WEP|M_AMPDU_MPDU)
    285      1.12  degroote 
    286  1.21.2.1      phil #define	IEEE80211_MBUF_TX_FLAG_BITS \
    287  1.21.2.1      phil 	M_FLAG_BITS \
    288  1.21.2.1      phil 	"\15M_ENCAP\17M_EAPOL\20M_PWR_SAV\21M_MORE_DATA\22M_FF\23M_TXCB" \
    289  1.21.2.1      phil 	"\24M_AMPDU_MPDU\25M_FRAG\26M_FIRSTFRAG\27M_LASTFRAG"
    290  1.21.2.1      phil 
    291  1.21.2.1      phil #define	IEEE80211_MBUF_RX_FLAG_BITS \
    292  1.21.2.1      phil 	M_FLAG_BITS \
    293  1.21.2.1      phil 	"\15M_AMPDU\16M_WEP\24M_AMPDU_MPDU"
    294       1.2    dyoung 
    295  1.21.2.1      phil /*
    296  1.21.2.1      phil  * Store WME access control bits in the vlan tag.
    297  1.21.2.1      phil  * This is safe since it's done after the packet is classified
    298  1.21.2.1      phil  * (where we use any previous tag) and because it's passed
    299  1.21.2.1      phil  * directly in to the driver and there's no chance someone
    300  1.21.2.1      phil  * else will clobber them on us.
    301  1.21.2.1      phil  */
    302       1.2    dyoung #define	M_WME_SETAC(m, ac) \
    303  1.21.2.1      phil 	((m)->m_pkthdr.ether_vtag = (ac))
    304  1.21.2.1      phil #define	M_WME_GETAC(m)	((m)->m_pkthdr.ether_vtag)
    305       1.2    dyoung 
    306       1.2    dyoung /*
    307       1.2    dyoung  * Mbufs on the power save queue are tagged with an age and
    308       1.2    dyoung  * timed out.  We reuse the hardware checksum field in the
    309       1.2    dyoung  * mbuf packet header to store this data.
    310       1.2    dyoung  */
    311       1.2    dyoung #define	M_AGE_SET(m,v)		(m->m_pkthdr.csum_data = v)
    312       1.2    dyoung #define	M_AGE_GET(m)		(m->m_pkthdr.csum_data)
    313       1.2    dyoung #define	M_AGE_SUB(m,adj)	(m->m_pkthdr.csum_data -= adj)
    314       1.2    dyoung 
    315  1.21.2.1      phil /*
    316  1.21.2.1      phil  * Store the sequence number.
    317  1.21.2.1      phil  */
    318  1.21.2.1      phil #define	M_SEQNO_SET(m, seqno) \
    319  1.21.2.1      phil 	((m)->m_pkthdr.tso_segsz = (seqno))
    320  1.21.2.1      phil #define	M_SEQNO_GET(m)	((m)->m_pkthdr.tso_segsz)
    321  1.21.2.1      phil 
    322  1.21.2.1      phil #define	MTAG_ABI_NET80211	1132948340	/* net80211 ABI */
    323  1.21.2.1      phil 
    324  1.21.2.1      phil struct ieee80211_cb {
    325  1.21.2.1      phil 	void	(*func)(struct ieee80211_node *, void *, int status);
    326  1.21.2.1      phil 	void	*arg;
    327  1.21.2.1      phil };
    328  1.21.2.1      phil #define	NET80211_TAG_CALLBACK	0	/* xmit complete callback */
    329  1.21.2.1      phil int	ieee80211_add_callback(struct mbuf *m,
    330  1.21.2.1      phil 		void (*func)(struct ieee80211_node *, void *, int), void *arg);
    331  1.21.2.1      phil void	ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
    332  1.21.2.1      phil 
    333  1.21.2.1      phil #define	NET80211_TAG_XMIT_PARAMS	1
    334  1.21.2.1      phil /* See below; this is after the bpf_params definition */
    335  1.21.2.1      phil 
    336  1.21.2.1      phil #define	NET80211_TAG_RECV_PARAMS	2
    337  1.21.2.1      phil 
    338  1.21.2.1      phil #define	NET80211_TAG_TOA_PARAMS		3
    339  1.21.2.1      phil 
    340       1.2    dyoung struct ieee80211com;
    341  1.21.2.1      phil int	ieee80211_parent_xmitpkt(struct ieee80211com *, struct mbuf *);
    342  1.21.2.1      phil int	ieee80211_vap_xmitpkt(struct ieee80211vap *, struct mbuf *);
    343  1.21.2.1      phil 
    344  1.21.2.1      phil void	get_random_bytes(void *, size_t);
    345  1.21.2.1      phil 
    346  1.21.2.1      phil void	ieee80211_sysctl_attach(struct ieee80211com *);
    347  1.21.2.1      phil void	ieee80211_sysctl_detach(struct ieee80211com *);
    348  1.21.2.1      phil void	ieee80211_sysctl_vattach(struct ieee80211vap *);
    349  1.21.2.1      phil void	ieee80211_sysctl_vdetach(struct ieee80211vap *);
    350  1.21.2.1      phil 
    351  1.21.2.1      phil SYSCTL_DECL(_net_wlan);
    352  1.21.2.1      phil int	ieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS);
    353  1.21.2.1      phil 
    354  1.21.2.1      phil void	ieee80211_load_module(const char *);
    355  1.21.2.1      phil 
    356  1.21.2.1      phil /*
    357  1.21.2.1      phil  * A "policy module" is an adjunct module to net80211 that provides
    358  1.21.2.1      phil  * functionality that typically includes policy decisions.  This
    359  1.21.2.1      phil  * modularity enables extensibility and vendor-supplied functionality.
    360  1.21.2.1      phil  */
    361  1.21.2.1      phil #define	_IEEE80211_POLICY_MODULE(policy, name, version)			\
    362  1.21.2.1      phil typedef void (*policy##_setup)(int);					\
    363  1.21.2.1      phil SET_DECLARE(policy##_set, policy##_setup);				\
    364  1.21.2.1      phil static int								\
    365  1.21.2.1      phil wlan_##name##_modevent(module_t mod, int type, void *unused)		\
    366  1.21.2.1      phil {									\
    367  1.21.2.1      phil 	policy##_setup * const *iter, f;				\
    368  1.21.2.1      phil 	switch (type) {							\
    369  1.21.2.1      phil 	case MOD_LOAD:							\
    370  1.21.2.1      phil 		SET_FOREACH(iter, policy##_set) {			\
    371  1.21.2.1      phil 			f = (void*) *iter;				\
    372  1.21.2.1      phil 			f(type);					\
    373  1.21.2.1      phil 		}							\
    374  1.21.2.1      phil 		return 0;						\
    375  1.21.2.1      phil 	case MOD_UNLOAD:						\
    376  1.21.2.1      phil 	case MOD_QUIESCE:						\
    377  1.21.2.1      phil 		if (nrefs) {						\
    378  1.21.2.1      phil 			printf("wlan_" #name ": still in use "		\
    379  1.21.2.1      phil 				"(%u dynamic refs)\n", nrefs);		\
    380  1.21.2.1      phil 			return EBUSY;					\
    381  1.21.2.1      phil 		}							\
    382  1.21.2.1      phil 		if (type == MOD_UNLOAD) {				\
    383  1.21.2.1      phil 			SET_FOREACH(iter, policy##_set) {		\
    384  1.21.2.1      phil 				f = (void*) *iter;			\
    385  1.21.2.1      phil 				f(type);				\
    386  1.21.2.1      phil 			}						\
    387  1.21.2.1      phil 		}							\
    388  1.21.2.1      phil 		return 0;						\
    389  1.21.2.1      phil 	}								\
    390  1.21.2.1      phil 	return EINVAL;							\
    391  1.21.2.1      phil }									\
    392  1.21.2.1      phil static moduledata_t name##_mod = {					\
    393  1.21.2.1      phil 	"wlan_" #name,							\
    394  1.21.2.1      phil 	wlan_##name##_modevent,						\
    395  1.21.2.1      phil 	0								\
    396  1.21.2.1      phil };									\
    397  1.21.2.1      phil DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
    398  1.21.2.1      phil MODULE_VERSION(wlan_##name, version);					\
    399  1.21.2.1      phil MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)
    400  1.21.2.1      phil 
    401  1.21.2.1      phil /*
    402  1.21.2.1      phil  * Crypto modules implement cipher support.
    403  1.21.2.1      phil  */
    404  1.21.2.1      phil #define	IEEE80211_CRYPTO_MODULE(name, version)				\
    405  1.21.2.1      phil _IEEE80211_POLICY_MODULE(crypto, name, version);			\
    406  1.21.2.1      phil static void								\
    407  1.21.2.1      phil name##_modevent(int type)						\
    408  1.21.2.1      phil {									\
    409  1.21.2.1      phil 	if (type == MOD_LOAD)						\
    410  1.21.2.1      phil 		ieee80211_crypto_register(&name);			\
    411  1.21.2.1      phil 	else								\
    412  1.21.2.1      phil 		ieee80211_crypto_unregister(&name);			\
    413  1.21.2.1      phil }									\
    414  1.21.2.1      phil TEXT_SET(crypto##_set, name##_modevent)
    415  1.21.2.1      phil 
    416  1.21.2.1      phil /*
    417  1.21.2.1      phil  * Scanner modules provide scanning policy.
    418  1.21.2.1      phil  */
    419  1.21.2.1      phil #define	IEEE80211_SCANNER_MODULE(name, version)				\
    420  1.21.2.1      phil 	_IEEE80211_POLICY_MODULE(scanner, name, version)
    421  1.21.2.1      phil 
    422  1.21.2.1      phil #define	IEEE80211_SCANNER_ALG(name, alg, v)				\
    423  1.21.2.1      phil static void								\
    424  1.21.2.1      phil name##_modevent(int type)						\
    425  1.21.2.1      phil {									\
    426  1.21.2.1      phil 	if (type == MOD_LOAD)						\
    427  1.21.2.1      phil 		ieee80211_scanner_register(alg, &v);			\
    428  1.21.2.1      phil 	else								\
    429  1.21.2.1      phil 		ieee80211_scanner_unregister(alg, &v);			\
    430  1.21.2.1      phil }									\
    431  1.21.2.1      phil TEXT_SET(scanner_set, name##_modevent);					\
    432  1.21.2.1      phil 
    433  1.21.2.1      phil /*
    434  1.21.2.1      phil  * ACL modules implement acl policy.
    435  1.21.2.1      phil  */
    436  1.21.2.1      phil #define	IEEE80211_ACL_MODULE(name, alg, version)			\
    437  1.21.2.1      phil _IEEE80211_POLICY_MODULE(acl, name, version);				\
    438  1.21.2.1      phil static void								\
    439  1.21.2.1      phil alg##_modevent(int type)						\
    440  1.21.2.1      phil {									\
    441  1.21.2.1      phil 	if (type == MOD_LOAD)						\
    442  1.21.2.1      phil 		ieee80211_aclator_register(&alg);			\
    443  1.21.2.1      phil 	else								\
    444  1.21.2.1      phil 		ieee80211_aclator_unregister(&alg);			\
    445  1.21.2.1      phil }									\
    446  1.21.2.1      phil TEXT_SET(acl_set, alg##_modevent);					\
    447  1.21.2.1      phil 
    448  1.21.2.1      phil /*
    449  1.21.2.1      phil  * Authenticator modules handle 802.1x/WPA authentication.
    450  1.21.2.1      phil  */
    451  1.21.2.1      phil #define	IEEE80211_AUTH_MODULE(name, version)				\
    452  1.21.2.1      phil 	_IEEE80211_POLICY_MODULE(auth, name, version)
    453  1.21.2.1      phil 
    454  1.21.2.1      phil #define	IEEE80211_AUTH_ALG(name, alg, v)				\
    455  1.21.2.1      phil static void								\
    456  1.21.2.1      phil name##_modevent(int type)						\
    457  1.21.2.1      phil {									\
    458  1.21.2.1      phil 	if (type == MOD_LOAD)						\
    459  1.21.2.1      phil 		ieee80211_authenticator_register(alg, &v);		\
    460  1.21.2.1      phil 	else								\
    461  1.21.2.1      phil 		ieee80211_authenticator_unregister(alg);		\
    462  1.21.2.1      phil }									\
    463  1.21.2.1      phil TEXT_SET(auth_set, name##_modevent)
    464  1.21.2.1      phil 
    465  1.21.2.1      phil /*
    466  1.21.2.1      phil  * Rate control modules provide tx rate control support.
    467  1.21.2.1      phil  */
    468  1.21.2.1      phil #define	IEEE80211_RATECTL_MODULE(alg, version)				\
    469  1.21.2.1      phil 	_IEEE80211_POLICY_MODULE(ratectl, alg, version);		\
    470  1.21.2.1      phil 
    471  1.21.2.1      phil #define	IEEE80211_RATECTL_ALG(name, alg, v)				\
    472  1.21.2.1      phil static void								\
    473  1.21.2.1      phil alg##_modevent(int type)						\
    474  1.21.2.1      phil {									\
    475  1.21.2.1      phil 	if (type == MOD_LOAD)						\
    476  1.21.2.1      phil 		ieee80211_ratectl_register(alg, &v);			\
    477  1.21.2.1      phil 	else								\
    478  1.21.2.1      phil 		ieee80211_ratectl_unregister(alg);			\
    479  1.21.2.1      phil }									\
    480  1.21.2.1      phil TEXT_SET(ratectl##_set, alg##_modevent)
    481  1.21.2.1      phil 
    482  1.21.2.1      phil struct ieee80211req;
    483  1.21.2.1      phil typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,
    484  1.21.2.1      phil     struct ieee80211req *);
    485  1.21.2.1      phil SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc);
    486  1.21.2.1      phil #define	IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get)
    487  1.21.2.1      phil 
    488  1.21.2.1      phil typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *,
    489  1.21.2.1      phil     struct ieee80211req *);
    490  1.21.2.1      phil SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);
    491  1.21.2.1      phil #define	IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)
    492      1.13    dyoung #endif /* _KERNEL */
    493       1.2    dyoung 
    494       1.2    dyoung /* XXX this stuff belongs elsewhere */
    495       1.2    dyoung /*
    496       1.2    dyoung  * Message formats for messages from the net80211 layer to user
    497       1.2    dyoung  * applications via the routing socket.  These messages are appended
    498       1.2    dyoung  * to an if_announcemsghdr structure.
    499       1.2    dyoung  */
    500       1.2    dyoung struct ieee80211_join_event {
    501       1.2    dyoung 	uint8_t		iev_addr[6];
    502       1.2    dyoung };
    503       1.2    dyoung 
    504       1.2    dyoung struct ieee80211_leave_event {
    505       1.2    dyoung 	uint8_t		iev_addr[6];
    506       1.2    dyoung };
    507       1.2    dyoung 
    508       1.2    dyoung struct ieee80211_replay_event {
    509       1.2    dyoung 	uint8_t		iev_src[6];	/* src MAC */
    510       1.2    dyoung 	uint8_t		iev_dst[6];	/* dst MAC */
    511       1.2    dyoung 	uint8_t		iev_cipher;	/* cipher type */
    512       1.2    dyoung 	uint8_t		iev_keyix;	/* key id/index */
    513       1.2    dyoung 	uint64_t	iev_keyrsc;	/* RSC from key */
    514       1.2    dyoung 	uint64_t	iev_rsc;	/* RSC from frame */
    515       1.2    dyoung };
    516       1.2    dyoung 
    517       1.2    dyoung struct ieee80211_michael_event {
    518       1.2    dyoung 	uint8_t		iev_src[6];	/* src MAC */
    519       1.2    dyoung 	uint8_t		iev_dst[6];	/* dst MAC */
    520       1.2    dyoung 	uint8_t		iev_cipher;	/* cipher type */
    521       1.2    dyoung 	uint8_t		iev_keyix;	/* key id/index */
    522       1.2    dyoung };
    523       1.2    dyoung 
    524  1.21.2.1      phil struct ieee80211_wds_event {
    525  1.21.2.1      phil 	uint8_t		iev_addr[6];
    526  1.21.2.1      phil };
    527  1.21.2.1      phil 
    528  1.21.2.1      phil struct ieee80211_csa_event {
    529  1.21.2.1      phil 	uint32_t	iev_flags;	/* channel flags */
    530  1.21.2.1      phil 	uint16_t	iev_freq;	/* setting in Mhz */
    531  1.21.2.1      phil 	uint8_t		iev_ieee;	/* IEEE channel number */
    532  1.21.2.1      phil 	uint8_t		iev_mode;	/* CSA mode */
    533  1.21.2.1      phil 	uint8_t		iev_count;	/* CSA count */
    534  1.21.2.1      phil };
    535  1.21.2.1      phil 
    536  1.21.2.1      phil struct ieee80211_cac_event {
    537  1.21.2.1      phil 	uint32_t	iev_flags;	/* channel flags */
    538  1.21.2.1      phil 	uint16_t	iev_freq;	/* setting in Mhz */
    539  1.21.2.1      phil 	uint8_t		iev_ieee;	/* IEEE channel number */
    540  1.21.2.1      phil 	/* XXX timestamp? */
    541  1.21.2.1      phil 	uint8_t		iev_type;	/* IEEE80211_NOTIFY_CAC_* */
    542  1.21.2.1      phil };
    543  1.21.2.1      phil 
    544  1.21.2.1      phil struct ieee80211_radar_event {
    545  1.21.2.1      phil 	uint32_t	iev_flags;	/* channel flags */
    546  1.21.2.1      phil 	uint16_t	iev_freq;	/* setting in Mhz */
    547  1.21.2.1      phil 	uint8_t		iev_ieee;	/* IEEE channel number */
    548  1.21.2.1      phil 	/* XXX timestamp? */
    549  1.21.2.1      phil };
    550  1.21.2.1      phil 
    551  1.21.2.1      phil struct ieee80211_auth_event {
    552  1.21.2.1      phil 	uint8_t		iev_addr[6];
    553  1.21.2.1      phil };
    554  1.21.2.1      phil 
    555  1.21.2.1      phil struct ieee80211_deauth_event {
    556  1.21.2.1      phil 	uint8_t		iev_addr[6];
    557  1.21.2.1      phil };
    558  1.21.2.1      phil 
    559  1.21.2.1      phil struct ieee80211_country_event {
    560  1.21.2.1      phil 	uint8_t		iev_addr[6];
    561  1.21.2.1      phil 	uint8_t		iev_cc[2];	/* ISO country code */
    562  1.21.2.1      phil };
    563  1.21.2.1      phil 
    564  1.21.2.1      phil struct ieee80211_radio_event {
    565  1.21.2.1      phil 	uint8_t		iev_state;	/* 1 on, 0 off */
    566  1.21.2.1      phil };
    567  1.21.2.1      phil 
    568       1.2    dyoung #define	RTM_IEEE80211_ASSOC	100	/* station associate (bss mode) */
    569       1.2    dyoung #define	RTM_IEEE80211_REASSOC	101	/* station re-associate (bss mode) */
    570       1.2    dyoung #define	RTM_IEEE80211_DISASSOC	102	/* station disassociate (bss mode) */
    571       1.2    dyoung #define	RTM_IEEE80211_JOIN	103	/* station join (ap mode) */
    572       1.2    dyoung #define	RTM_IEEE80211_LEAVE	104	/* station leave (ap mode) */
    573       1.2    dyoung #define	RTM_IEEE80211_SCAN	105	/* scan complete, results available */
    574       1.2    dyoung #define	RTM_IEEE80211_REPLAY	106	/* sequence counter replay detected */
    575       1.2    dyoung #define	RTM_IEEE80211_MICHAEL	107	/* Michael MIC failure detected */
    576       1.2    dyoung #define	RTM_IEEE80211_REJOIN	108	/* station re-associate (ap mode) */
    577  1.21.2.1      phil #define	RTM_IEEE80211_WDS	109	/* WDS discovery (ap mode) */
    578  1.21.2.1      phil #define	RTM_IEEE80211_CSA	110	/* Channel Switch Announcement event */
    579  1.21.2.1      phil #define	RTM_IEEE80211_RADAR	111	/* radar event */
    580  1.21.2.1      phil #define	RTM_IEEE80211_CAC	112	/* Channel Availability Check event */
    581  1.21.2.1      phil #define	RTM_IEEE80211_DEAUTH	113	/* station deauthenticate */
    582  1.21.2.1      phil #define	RTM_IEEE80211_AUTH	114	/* station authenticate (ap mode) */
    583  1.21.2.1      phil #define	RTM_IEEE80211_COUNTRY	115	/* discovered country code (sta mode) */
    584  1.21.2.1      phil #define	RTM_IEEE80211_RADIO	116	/* RF kill switch state change */
    585  1.21.2.1      phil 
    586  1.21.2.1      phil /*
    587  1.21.2.1      phil  * Structure prepended to raw packets sent through the bpf
    588  1.21.2.1      phil  * interface when set to DLT_IEEE802_11_RADIO.  This allows
    589  1.21.2.1      phil  * user applications to specify pretty much everything in
    590  1.21.2.1      phil  * an Atheros tx descriptor.  XXX need to generalize.
    591  1.21.2.1      phil  *
    592  1.21.2.1      phil  * XXX cannot be more than 14 bytes as it is copied to a sockaddr's
    593  1.21.2.1      phil  * XXX sa_data area.
    594  1.21.2.1      phil  */
    595  1.21.2.1      phil struct ieee80211_bpf_params {
    596  1.21.2.1      phil 	uint8_t		ibp_vers;	/* version */
    597  1.21.2.1      phil #define	IEEE80211_BPF_VERSION	0
    598  1.21.2.1      phil 	uint8_t		ibp_len;	/* header length in bytes */
    599  1.21.2.1      phil 	uint8_t		ibp_flags;
    600  1.21.2.1      phil #define	IEEE80211_BPF_SHORTPRE	0x01	/* tx with short preamble */
    601  1.21.2.1      phil #define	IEEE80211_BPF_NOACK	0x02	/* tx with no ack */
    602  1.21.2.1      phil #define	IEEE80211_BPF_CRYPTO	0x04	/* tx with h/w encryption */
    603  1.21.2.1      phil #define	IEEE80211_BPF_FCS	0x10	/* frame incldues FCS */
    604  1.21.2.1      phil #define	IEEE80211_BPF_DATAPAD	0x20	/* frame includes data padding */
    605  1.21.2.1      phil #define	IEEE80211_BPF_RTS	0x40	/* tx with RTS/CTS */
    606  1.21.2.1      phil #define	IEEE80211_BPF_CTS	0x80	/* tx with CTS only */
    607  1.21.2.1      phil 	uint8_t		ibp_pri;	/* WME/WMM AC+tx antenna */
    608  1.21.2.1      phil 	uint8_t		ibp_try0;	/* series 1 try count */
    609  1.21.2.1      phil 	uint8_t		ibp_rate0;	/* series 1 IEEE tx rate */
    610  1.21.2.1      phil 	uint8_t		ibp_power;	/* tx power (device units) */
    611  1.21.2.1      phil 	uint8_t		ibp_ctsrate;	/* IEEE tx rate for CTS */
    612  1.21.2.1      phil 	uint8_t		ibp_try1;	/* series 2 try count */
    613  1.21.2.1      phil 	uint8_t		ibp_rate1;	/* series 2 IEEE tx rate */
    614  1.21.2.1      phil 	uint8_t		ibp_try2;	/* series 3 try count */
    615  1.21.2.1      phil 	uint8_t		ibp_rate2;	/* series 3 IEEE tx rate */
    616  1.21.2.1      phil 	uint8_t		ibp_try3;	/* series 4 try count */
    617  1.21.2.1      phil 	uint8_t		ibp_rate3;	/* series 4 IEEE tx rate */
    618  1.21.2.1      phil };
    619       1.2    dyoung 
    620      1.13    dyoung #ifdef _KERNEL
    621  1.21.2.1      phil struct ieee80211_tx_params {
    622  1.21.2.1      phil 	struct ieee80211_bpf_params params;
    623  1.21.2.1      phil };
    624  1.21.2.1      phil int	ieee80211_add_xmit_params(struct mbuf *m,
    625  1.21.2.1      phil 	    const struct ieee80211_bpf_params *);
    626  1.21.2.1      phil int	ieee80211_get_xmit_params(struct mbuf *m,
    627  1.21.2.1      phil 	    struct ieee80211_bpf_params *);
    628  1.21.2.1      phil 
    629  1.21.2.1      phil struct ieee80211_rx_params;
    630  1.21.2.1      phil struct ieee80211_rx_stats;
    631  1.21.2.1      phil 
    632  1.21.2.1      phil int	ieee80211_add_rx_params(struct mbuf *m,
    633  1.21.2.1      phil 	    const struct ieee80211_rx_stats *rxs);
    634  1.21.2.1      phil int	ieee80211_get_rx_params(struct mbuf *m,
    635  1.21.2.1      phil 	    struct ieee80211_rx_stats *rxs);
    636  1.21.2.1      phil const struct ieee80211_rx_stats * ieee80211_get_rx_params_ptr(struct mbuf *m);
    637       1.2    dyoung 
    638  1.21.2.1      phil struct ieee80211_toa_params {
    639  1.21.2.1      phil 	int request_id;
    640  1.21.2.1      phil };
    641  1.21.2.1      phil int	ieee80211_add_toa_params(struct mbuf *m,
    642  1.21.2.1      phil 	    const struct ieee80211_toa_params *p);
    643  1.21.2.1      phil int	ieee80211_get_toa_params(struct mbuf *m,
    644  1.21.2.1      phil 	    struct ieee80211_toa_params *p);
    645  1.21.2.1      phil 
    646  1.21.2.1      phil #define	IEEE80211_F_SURVEY_TIME		0x00000001
    647  1.21.2.1      phil #define	IEEE80211_F_SURVEY_TIME_BUSY	0x00000002
    648  1.21.2.1      phil #define	IEEE80211_F_SURVEY_NOISE_DBM	0x00000004
    649  1.21.2.1      phil #define	IEEE80211_F_SURVEY_TSC		0x00000008
    650  1.21.2.1      phil struct ieee80211_channel_survey {
    651  1.21.2.1      phil 	uint32_t s_flags;
    652  1.21.2.1      phil 	uint32_t s_time;
    653  1.21.2.1      phil 	uint32_t s_time_busy;
    654  1.21.2.1      phil 	int32_t s_noise;
    655  1.21.2.1      phil 	uint64_t s_tsc;
    656  1.21.2.1      phil };
    657       1.6     skrll 
    658  1.21.2.1      phil #endif /* _KERNEL */
    659       1.2    dyoung 
    660  1.21.2.1      phil /*
    661  1.21.2.1      phil  * Malloc API.  Other BSD operating systems have slightly
    662  1.21.2.1      phil  * different malloc/free namings (eg DragonflyBSD.)
    663  1.21.2.1      phil  */
    664  1.21.2.1      phil #define	IEEE80211_MALLOC	malloc
    665  1.21.2.1      phil #define	IEEE80211_FREE		free
    666      1.19     pooka 
    667  1.21.2.1      phil /* XXX TODO: get rid of WAITOK, fix all the users of it? */
    668  1.21.2.1      phil #define	IEEE80211_M_NOWAIT	M_NOWAIT
    669  1.21.2.1      phil #define	IEEE80211_M_WAITOK	M_WAITOK
    670  1.21.2.1      phil #define	IEEE80211_M_ZERO	M_ZERO
    671       1.7     skrll 
    672  1.21.2.1      phil /* XXX TODO: the type fields */
    673      1.20      maxv 
    674  1.21.2.1      phil #endif /* _NET80211_IEEE80211_FREEBSD_H_ */
    675