ieee80211_freebsd.h revision 178354
1/*-
2 * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * $FreeBSD: head/sys/net80211/ieee80211_freebsd.h 178354 2008-04-20 20:35:46Z sam $
26 */
27#ifndef _NET80211_IEEE80211_FREEBSD_H_
28#define _NET80211_IEEE80211_FREEBSD_H_
29
30#ifdef _KERNEL
31#include <sys/param.h>
32#include <sys/lock.h>
33#include <sys/mutex.h>
34#include <sys/rwlock.h>
35
36/*
37 * Common state locking definitions.
38 */
39typedef struct mtx ieee80211_com_lock_t;
40#define	IEEE80211_LOCK_INIT(_ic, _name) \
41	mtx_init(&(_ic)->ic_comlock, _name, "802.11 com lock", \
42	    MTX_DEF | MTX_RECURSE)
43#define	IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(&(_ic)->ic_comlock)
44#define	IEEE80211_LOCK(_ic)	   mtx_lock(&(_ic)->ic_comlock)
45#define	IEEE80211_UNLOCK(_ic)	   mtx_unlock(&(_ic)->ic_comlock)
46#define	IEEE80211_LOCK_ASSERT(_ic) \
47	mtx_assert(&(_ic)->ic_comlock, MA_OWNED)
48
49/*
50 * Node locking definitions.
51 */
52typedef struct {
53	char		name[16];		/* e.g. "ath0_node_lock" */
54	struct mtx	mtx;
55} ieee80211_node_lock_t;
56#define	IEEE80211_NODE_LOCK_INIT(_nt, _name) do {			\
57	ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock;		\
58	snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name);	\
59	mtx_init(&nl->mtx, NULL, nl->name, MTX_DEF | MTX_RECURSE);	\
60} while (0)
61#define	IEEE80211_NODE_LOCK_DESTROY(_nt) \
62	mtx_destroy(&(_nt)->nt_nodelock.mtx)
63#define	IEEE80211_NODE_LOCK(_nt) \
64	mtx_lock(&(_nt)->nt_nodelock.mtx)
65#define	IEEE80211_NODE_IS_LOCKED(_nt) \
66	mtx_owned(&(_nt)->nt_nodelock.mtx)
67#define	IEEE80211_NODE_UNLOCK(_nt) \
68	mtx_unlock(&(_nt)->nt_nodelock.mtx)
69#define	IEEE80211_NODE_LOCK_ASSERT(_nt)	\
70	mtx_assert(&(_nt)->nt_nodelock.mtx, MA_OWNED)
71
72/*
73 * Node table iteration locking definitions; this protects the
74 * scan generation # used to iterate over the station table
75 * while grabbing+releasing the node lock.
76 */
77typedef struct {
78	char		name[16];		/* e.g. "ath0_scan_lock" */
79	struct mtx	mtx;
80} ieee80211_scan_lock_t;
81#define	IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do {		\
82	ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock;		\
83	snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name);	\
84	mtx_init(&sl->mtx, NULL, sl->name, MTX_DEF);			\
85} while (0)
86#define	IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \
87	mtx_destroy(&(_nt)->nt_scanlock.mtx)
88#define	IEEE80211_NODE_ITERATE_LOCK(_nt) \
89	mtx_lock(&(_nt)->nt_scanlock.mtx)
90#define	IEEE80211_NODE_ITERATE_UNLOCK(_nt) \
91	mtx_unlock(&(_nt)->nt_scanlock.mtx)
92
93#define	_AGEQ_ENQUEUE(_ifq, _m, _qlen, _age) do {		\
94	(_m)->m_nextpkt = NULL;					\
95	if ((_ifq)->ifq_tail != NULL) { 			\
96		_age -= M_AGE_GET((_ifq)->ifq_tail);		\
97		(_ifq)->ifq_tail->m_nextpkt = (_m);		\
98	} else { 						\
99		(_ifq)->ifq_head = (_m); 			\
100	}							\
101	M_AGE_SET(_m, _age);					\
102	(_ifq)->ifq_tail = (_m); 				\
103	(_qlen) = ++(_ifq)->ifq_len; 				\
104} while (0)
105
106/*
107 * Per-node power-save queue definitions.
108 */
109#define	IEEE80211_NODE_SAVEQ_INIT(_ni, _name) do {		\
110	mtx_init(&(_ni)->ni_savedq.ifq_mtx, _name, "802.11 ps queue", MTX_DEF);\
111	(_ni)->ni_savedq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE;	\
112} while (0)
113#define	IEEE80211_NODE_SAVEQ_DESTROY(_ni) \
114	mtx_destroy(&(_ni)->ni_savedq.ifq_mtx)
115#define	IEEE80211_NODE_SAVEQ_QLEN(_ni) \
116	_IF_QLEN(&(_ni)->ni_savedq)
117#define	IEEE80211_NODE_SAVEQ_LOCK(_ni) do {	\
118	IF_LOCK(&(_ni)->ni_savedq);				\
119} while (0)
120#define	IEEE80211_NODE_SAVEQ_UNLOCK(_ni) do {	\
121	IF_UNLOCK(&(_ni)->ni_savedq);				\
122} while (0)
123#define	IEEE80211_NODE_SAVEQ_DEQUEUE(_ni, _m, _qlen) do {	\
124	IEEE80211_NODE_SAVEQ_LOCK(_ni);				\
125	_IF_DEQUEUE(&(_ni)->ni_savedq, _m);			\
126	(_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni);		\
127	IEEE80211_NODE_SAVEQ_UNLOCK(_ni);			\
128} while (0)
129#define	IEEE80211_NODE_SAVEQ_DRAIN(_ni, _qlen) do {		\
130	IEEE80211_NODE_SAVEQ_LOCK(_ni);				\
131	(_qlen) = IEEE80211_NODE_SAVEQ_QLEN(_ni);		\
132	_IF_DRAIN(&(_ni)->ni_savedq);				\
133	IEEE80211_NODE_SAVEQ_UNLOCK(_ni);			\
134} while (0)
135/* XXX could be optimized */
136#define	_IEEE80211_NODE_SAVEQ_DEQUEUE_HEAD(_ni, _m) do {	\
137	_IF_DEQUEUE(&(_ni)->ni_savedq, m);			\
138} while (0)
139#define	_IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _m, _qlen, _age) do {\
140	_AGEQ_ENQUEUE(&ni->ni_savedq, _m, _qlen, _age);		\
141} while (0)
142
143#define	IEEE80211_TAPQ_INIT(_tap) do {				\
144	mtx_init(&(tap)->txa_q.ifq_mtx, "ampdu tx queue", NULL, MTX_DEF); \
145	(_tap)->txa_q.ifq_maxlen = IEEE80211_AGGR_BAWMAX;	\
146} while (0)
147#define	IEEE80211_TAPQ_DESTROY(_tap) \
148	mtx_destroy(&(_tap)->txa_q.ifq_mtx)
149
150#ifndef IF_PREPEND_LIST
151#define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {	\
152	(mtail)->m_nextpkt = (ifq)->ifq_head;			\
153	if ((ifq)->ifq_tail == NULL)				\
154		(ifq)->ifq_tail = (mtail);			\
155	(ifq)->ifq_head = (mhead);				\
156	(ifq)->ifq_len += (mcount);				\
157} while (0)
158#define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {		\
159	IF_LOCK(ifq);						\
160	_IF_PREPEND_LIST(ifq, mhead, mtail, mcount);		\
161	IF_UNLOCK(ifq);						\
162} while (0)
163#endif /* IF_PREPEND_LIST */
164
165/* XXX temporary */
166#define	IEEE80211_NODE_WDSQ_INIT(_ni, _name) do {		\
167	mtx_init(&(_ni)->ni_wdsq.ifq_mtx, _name, "802.11 wds queue", MTX_DEF);\
168	(_ni)->ni_wdsq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE;	\
169} while (0)
170#define	IEEE80211_NODE_WDSQ_DESTROY(_ni) do { \
171	mtx_destroy(&(_ni)->ni_wdsq.ifq_mtx); \
172} while (0)
173#define	IEEE80211_NODE_WDSQ_QLEN(_ni)	_IF_QLEN(&(_ni)->ni_wdsq)
174#define	IEEE80211_NODE_WDSQ_LOCK(_ni)	IF_LOCK(&(_ni)->ni_wdsq)
175#define	IEEE80211_NODE_WDSQ_UNLOCK(_ni)	IF_UNLOCK(&(_ni)->ni_wdsq)
176#define	_IEEE80211_NODE_WDSQ_DEQUEUE_HEAD(_ni, _m) do {		\
177	_IF_DEQUEUE(&(_ni)->ni_wdsq, m);			\
178} while (0)
179#define	_IEEE80211_NODE_WDSQ_ENQUEUE(_ni, _m, _qlen, _age) do {	\
180	_AGEQ_ENQUEUE(&ni->ni_wdsq, _m, _qlen, _age);		\
181} while (0)
182
183/*
184 * 802.1x MAC ACL database locking definitions.
185 */
186typedef struct mtx acl_lock_t;
187#define	ACL_LOCK_INIT(_as, _name) \
188	mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF)
189#define	ACL_LOCK_DESTROY(_as)		mtx_destroy(&(_as)->as_lock)
190#define	ACL_LOCK(_as)			mtx_lock(&(_as)->as_lock)
191#define	ACL_UNLOCK(_as)			mtx_unlock(&(_as)->as_lock)
192#define	ACL_LOCK_ASSERT(_as) \
193	mtx_assert((&(_as)->as_lock), MA_OWNED)
194
195/*
196 * Node reference counting definitions.
197 *
198 * ieee80211_node_initref	initialize the reference count to 1
199 * ieee80211_node_incref	add a reference
200 * ieee80211_node_decref	remove a reference
201 * ieee80211_node_dectestref	remove a reference and return 1 if this
202 *				is the last reference, otherwise 0
203 * ieee80211_node_refcnt	reference count for printing (only)
204 */
205#include <machine/atomic.h>
206
207#define ieee80211_node_initref(_ni) \
208	do { ((_ni)->ni_refcnt = 1); } while (0)
209#define ieee80211_node_incref(_ni) \
210	atomic_add_int(&(_ni)->ni_refcnt, 1)
211#define	ieee80211_node_decref(_ni) \
212	atomic_subtract_int(&(_ni)->ni_refcnt, 1)
213struct ieee80211_node;
214int	ieee80211_node_dectestref(struct ieee80211_node *ni);
215#define	ieee80211_node_refcnt(_ni)	(_ni)->ni_refcnt
216
217struct ifqueue;
218struct ieee80211vap;
219void	ieee80211_drain_ifq(struct ifqueue *);
220void	ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
221
222void	ieee80211_vap_destroy(struct ieee80211vap *);
223
224#define	IFNET_IS_UP_RUNNING(_ifp) \
225	(((_ifp)->if_flags & IFF_UP) && \
226	 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
227
228#define	msecs_to_ticks(ms)	(((ms)*hz)/1000)
229#define	ticks_to_msecs(t)	(1000*(t) / hz)
230#define	ticks_to_secs(t)	((t) / hz)
231#define time_after(a,b) 	((long)(b) - (long)(a) < 0)
232#define time_before(a,b)	time_after(b,a)
233#define time_after_eq(a,b)	((long)(a) - (long)(b) >= 0)
234#define time_before_eq(a,b)	time_after_eq(b,a)
235
236#define	memmove(dst, src, n)	ovbcopy(src, dst, n)
237
238struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
239
240/* tx path usage */
241#define	M_LINK0		M_PROTO1		/* WEP requested */
242#define	M_WDS		M_PROTO2		/* WDS frame */
243#define	M_EAPOL		M_PROTO3		/* PAE/EAPOL frame */
244#define	M_PWR_SAV	M_PROTO4		/* bypass PS handling */
245#define	M_MORE_DATA	M_PROTO5		/* more data frames to follow */
246#define	M_FF		M_PROTO6		/* fast frame */
247#define	M_TXCB		M_PROTO7		/* do tx complete callback */
248#define	M_80211_TX \
249	(M_LINK0|M_WDS|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB)
250
251/* rx path usage */
252#define	M_AMPDU		M_PROTO1		/* A-MPDU processing done */
253#define	M_WEP		M_PROTO2		/* WEP done by hardware */
254#define	M_80211_RX	(M_AMPDU|M_WEP)
255/*
256 * Store WME access control bits in the vlan tag.
257 * This is safe since it's done after the packet is classified
258 * (where we use any previous tag) and because it's passed
259 * directly in to the driver and there's no chance someone
260 * else will clobber them on us.
261 */
262#define	M_WME_SETAC(m, ac) \
263	((m)->m_pkthdr.ether_vtag = (ac))
264#define	M_WME_GETAC(m)	((m)->m_pkthdr.ether_vtag)
265
266/*
267 * Mbufs on the power save queue are tagged with an age and
268 * timed out.  We reuse the hardware checksum field in the
269 * mbuf packet header to store this data.
270 */
271#define	M_AGE_SET(m,v)		(m->m_pkthdr.csum_data = v)
272#define	M_AGE_GET(m)		(m->m_pkthdr.csum_data)
273#define	M_AGE_SUB(m,adj)	(m->m_pkthdr.csum_data -= adj)
274
275#define	MTAG_ABI_NET80211	1132948340	/* net80211 ABI */
276
277struct ieee80211_cb {
278	void	(*func)(struct ieee80211_node *, void *, int status);
279	void	*arg;
280};
281#define	NET80211_TAG_CALLBACK	0	/* xmit complete callback */
282int	ieee80211_add_callback(struct mbuf *m,
283		void (*func)(struct ieee80211_node *, void *, int), void *arg);
284void	ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
285
286void	get_random_bytes(void *, size_t);
287
288struct ieee80211com;
289
290void	ieee80211_sysctl_attach(struct ieee80211com *);
291void	ieee80211_sysctl_detach(struct ieee80211com *);
292void	ieee80211_sysctl_vattach(struct ieee80211vap *);
293void	ieee80211_sysctl_vdetach(struct ieee80211vap *);
294
295void	ieee80211_load_module(const char *);
296
297/*
298 * A "policy module" is an adjunct module to net80211 that provides
299 * functionality that typically includes policy decisions.  This
300 * modularity enables extensibility and vendor-supplied functionality.
301 */
302#define	_IEEE80211_POLICY_MODULE(policy, name, version)			\
303typedef void (*policy##_setup)(int);					\
304SET_DECLARE(policy##_set, policy##_setup);				\
305static int								\
306wlan_##name##_modevent(module_t mod, int type, void *unused)		\
307{									\
308	policy##_setup * const *iter, f;				\
309	switch (type) {							\
310	case MOD_LOAD:							\
311		SET_FOREACH(iter, policy##_set) {			\
312			f = (void*) *iter;				\
313			f(type);					\
314		}							\
315		return 0;						\
316	case MOD_UNLOAD:						\
317	case MOD_QUIESCE:						\
318		if (nrefs) {						\
319			printf("wlan_##name: still in use (%u dynamic refs)\n",\
320				nrefs);					\
321			return EBUSY;					\
322		}							\
323		if (type == MOD_UNLOAD) {				\
324			SET_FOREACH(iter, policy##_set) {		\
325				f = (void*) *iter;			\
326				f(type);				\
327			}						\
328		}							\
329		return 0;						\
330	}								\
331	return EINVAL;							\
332}									\
333static moduledata_t name##_mod = {					\
334	"wlan_" #name,							\
335	wlan_##name##_modevent,						\
336	0								\
337};									\
338DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
339MODULE_VERSION(wlan_##name, version);					\
340MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)
341
342/*
343 * Crypto modules implement cipher support.
344 */
345#define	IEEE80211_CRYPTO_MODULE(name, version)				\
346_IEEE80211_POLICY_MODULE(crypto, name, version);			\
347static void								\
348name##_modevent(int type)						\
349{									\
350	if (type == MOD_LOAD)						\
351		ieee80211_crypto_register(&name);			\
352	else								\
353		ieee80211_crypto_unregister(&name);			\
354}									\
355TEXT_SET(crypto##_set, name##_modevent)
356
357/*
358 * Scanner modules provide scanning policy.
359 */
360#define	IEEE80211_SCANNER_MODULE(name, version)				\
361	_IEEE80211_POLICY_MODULE(scanner, name, version)
362
363#define	IEEE80211_SCANNER_ALG(name, alg, v)				\
364static void								\
365name##_modevent(int type)						\
366{									\
367	if (type == MOD_LOAD)						\
368		ieee80211_scanner_register(alg, &v);			\
369	else								\
370		ieee80211_scanner_unregister(alg, &v);			\
371}									\
372TEXT_SET(scanner_set, name##_modevent);					\
373
374/*
375 * ACL modules implement acl policy.
376 */
377#define	IEEE80211_ACL_MODULE(name, alg, version)			\
378_IEEE80211_POLICY_MODULE(acl, name, version);				\
379static void								\
380alg##_modevent(int type)						\
381{									\
382	if (type == MOD_LOAD)						\
383		ieee80211_aclator_register(&alg);			\
384	else								\
385		ieee80211_aclator_unregister(&alg);			\
386}									\
387TEXT_SET(acl_set, alg##_modevent);					\
388
389/*
390 * Authenticator modules handle 802.1x/WPA authentication.
391 */
392#define	IEEE80211_AUTH_MODULE(name, version)				\
393	_IEEE80211_POLICY_MODULE(auth, name, version)
394
395#define	IEEE80211_AUTH_ALG(name, alg, v)				\
396static void								\
397name##_modevent(int type)						\
398{									\
399	if (type == MOD_LOAD)						\
400		ieee80211_authenticator_register(alg, &v);		\
401	else								\
402		ieee80211_authenticator_unregister(alg);		\
403}									\
404TEXT_SET(auth_set, name##_modevent)
405
406/*
407 * Rate control modules provide tx rate control support.
408 */
409#define	IEEE80211_RATE_MODULE(alg, version)				\
410_IEEE80211_POLICY_MODULE(rate, alg, version);				\
411static void								\
412alg##_modevent(int type)						\
413{									\
414	/* XXX nothing to do until the rate control framework arrives */\
415}									\
416TEXT_SET(rate##_set, alg##_modevent)
417#endif /* _KERNEL */
418
419/* XXX this stuff belongs elsewhere */
420/*
421 * Message formats for messages from the net80211 layer to user
422 * applications via the routing socket.  These messages are appended
423 * to an if_announcemsghdr structure.
424 */
425struct ieee80211_join_event {
426	uint8_t		iev_addr[6];
427};
428
429struct ieee80211_leave_event {
430	uint8_t		iev_addr[6];
431};
432
433struct ieee80211_replay_event {
434	uint8_t		iev_src[6];	/* src MAC */
435	uint8_t		iev_dst[6];	/* dst MAC */
436	uint8_t		iev_cipher;	/* cipher type */
437	uint8_t		iev_keyix;	/* key id/index */
438	uint64_t	iev_keyrsc;	/* RSC from key */
439	uint64_t	iev_rsc;	/* RSC from frame */
440};
441
442struct ieee80211_michael_event {
443	uint8_t		iev_src[6];	/* src MAC */
444	uint8_t		iev_dst[6];	/* dst MAC */
445	uint8_t		iev_cipher;	/* cipher type */
446	uint8_t		iev_keyix;	/* key id/index */
447};
448
449struct ieee80211_wds_event {
450	uint8_t		iev_addr[6];
451};
452
453struct ieee80211_csa_event {
454	uint32_t	iev_flags;	/* channel flags */
455	uint16_t	iev_freq;	/* setting in Mhz */
456	uint8_t		iev_ieee;	/* IEEE channel number */
457	uint8_t		iev_mode;	/* CSA mode */
458	uint8_t		iev_count;	/* CSA count */
459};
460
461struct ieee80211_cac_event {
462	uint32_t	iev_flags;	/* channel flags */
463	uint16_t	iev_freq;	/* setting in Mhz */
464	uint8_t		iev_ieee;	/* IEEE channel number */
465	/* XXX timestamp? */
466	uint8_t		iev_type;	/* IEEE80211_NOTIFY_CAC_* */
467};
468
469struct ieee80211_radar_event {
470	uint32_t	iev_flags;	/* channel flags */
471	uint16_t	iev_freq;	/* setting in Mhz */
472	uint8_t		iev_ieee;	/* IEEE channel number */
473	/* XXX timestamp? */
474};
475
476struct ieee80211_auth_event {
477	uint8_t		iev_addr[6];
478};
479
480struct ieee80211_deauth_event {
481	uint8_t		iev_addr[6];
482};
483
484struct ieee80211_country_event {
485	uint8_t		iev_addr[6];
486	uint8_t		iev_cc[2];	/* ISO country code */
487};
488
489struct ieee80211_radio_event {
490	uint8_t		iev_state;	/* 1 on, 0 off */
491};
492
493#define	RTM_IEEE80211_ASSOC	100	/* station associate (bss mode) */
494#define	RTM_IEEE80211_REASSOC	101	/* station re-associate (bss mode) */
495#define	RTM_IEEE80211_DISASSOC	102	/* station disassociate (bss mode) */
496#define	RTM_IEEE80211_JOIN	103	/* station join (ap mode) */
497#define	RTM_IEEE80211_LEAVE	104	/* station leave (ap mode) */
498#define	RTM_IEEE80211_SCAN	105	/* scan complete, results available */
499#define	RTM_IEEE80211_REPLAY	106	/* sequence counter replay detected */
500#define	RTM_IEEE80211_MICHAEL	107	/* Michael MIC failure detected */
501#define	RTM_IEEE80211_REJOIN	108	/* station re-associate (ap mode) */
502#define	RTM_IEEE80211_WDS	109	/* WDS discovery (ap mode) */
503#define	RTM_IEEE80211_CSA	110	/* Channel Switch Announcement event */
504#define	RTM_IEEE80211_RADAR	111	/* radar event */
505#define	RTM_IEEE80211_CAC	112	/* Channel Availability Check event */
506#define	RTM_IEEE80211_DEAUTH	113	/* station deauthenticate */
507#define	RTM_IEEE80211_AUTH	114	/* station authenticate (ap mode) */
508#define	RTM_IEEE80211_COUNTRY	115	/* discovered country code (sta mode) */
509#define	RTM_IEEE80211_RADIO	116	/* RF kill switch state change */
510
511/*
512 * Structure prepended to raw packets sent through the bpf
513 * interface when set to DLT_IEEE802_11_RADIO.  This allows
514 * user applications to specify pretty much everything in
515 * an Atheros tx descriptor.  XXX need to generalize.
516 *
517 * XXX cannot be more than 14 bytes as it is copied to a sockaddr's
518 * XXX sa_data area.
519 */
520struct ieee80211_bpf_params {
521	uint8_t		ibp_vers;	/* version */
522#define	IEEE80211_BPF_VERSION	0
523	uint8_t		ibp_len;	/* header length in bytes */
524	uint8_t		ibp_flags;
525#define	IEEE80211_BPF_SHORTPRE	0x01	/* tx with short preamble */
526#define	IEEE80211_BPF_NOACK	0x02	/* tx with no ack */
527#define	IEEE80211_BPF_CRYPTO	0x04	/* tx with h/w encryption */
528#define	IEEE80211_BPF_FCS	0x10	/* frame incldues FCS */
529#define	IEEE80211_BPF_DATAPAD	0x20	/* frame includes data padding */
530#define	IEEE80211_BPF_RTS	0x40	/* tx with RTS/CTS */
531#define	IEEE80211_BPF_CTS	0x80	/* tx with CTS only */
532	uint8_t		ibp_pri;	/* WME/WMM AC+tx antenna */
533	uint8_t		ibp_try0;	/* series 1 try count */
534	uint8_t		ibp_rate0;	/* series 1 IEEE tx rate */
535	uint8_t		ibp_power;	/* tx power (device units) */
536	uint8_t		ibp_ctsrate;	/* IEEE tx rate for CTS */
537	uint8_t		ibp_try1;	/* series 2 try count */
538	uint8_t		ibp_rate1;	/* series 2 IEEE tx rate */
539	uint8_t		ibp_try2;	/* series 3 try count */
540	uint8_t		ibp_rate2;	/* series 3 IEEE tx rate */
541	uint8_t		ibp_try3;	/* series 4 try count */
542	uint8_t		ibp_rate3;	/* series 4 IEEE tx rate */
543};
544#endif /* _NET80211_IEEE80211_FREEBSD_H_ */
545