2 * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
27 #ifndef _NET80211_IEEE80211_FREEBSD_H_
28 #define _NET80211_IEEE80211_FREEBSD_H_
31 #include <sys/param.h>
33 #include <sys/mutex.h>
34 #include <sys/rwlock.h>
35 #include <sys/sysctl.h>
36 #include <sys/taskqueue.h>
39 * Common state locking definitions.
42 char name[16]; /* e.g. "ath0_com_lock" */
44 } ieee80211_com_lock_t;
45 #define IEEE80211_LOCK_INIT(_ic, _name) do { \
46 ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \
47 snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \
48 mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE); \
50 #define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx)
51 #define IEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic))
52 #define IEEE80211_LOCK(_ic) mtx_lock(IEEE80211_LOCK_OBJ(_ic))
53 #define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic))
54 #define IEEE80211_LOCK_ASSERT(_ic) \
55 mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
56 #define IEEE80211_UNLOCK_ASSERT(_ic) \
57 mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED)
62 * This is a (mostly) temporary lock designed to serialise all of the
63 * transmission operations throughout the stack.
66 char name[16]; /* e.g. "ath0_com_lock" */
68 } ieee80211_tx_lock_t;
69 #define IEEE80211_TX_LOCK_INIT(_ic, _name) do { \
70 ieee80211_tx_lock_t *cl = &(_ic)->ic_txlock; \
71 snprintf(cl->name, sizeof(cl->name), "%s_tx_lock", _name); \
72 mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF); \
74 #define IEEE80211_TX_LOCK_OBJ(_ic) (&(_ic)->ic_txlock.mtx)
75 #define IEEE80211_TX_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_TX_LOCK_OBJ(_ic))
76 #define IEEE80211_TX_LOCK(_ic) mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic))
77 #define IEEE80211_TX_UNLOCK(_ic) mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic))
78 #define IEEE80211_TX_LOCK_ASSERT(_ic) \
79 mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED)
80 #define IEEE80211_TX_UNLOCK_ASSERT(_ic) \
81 mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED)
84 * Node locking definitions.
87 char name[16]; /* e.g. "ath0_node_lock" */
89 } ieee80211_node_lock_t;
90 #define IEEE80211_NODE_LOCK_INIT(_nt, _name) do { \
91 ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock; \
92 snprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name); \
93 mtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE); \
95 #define IEEE80211_NODE_LOCK_OBJ(_nt) (&(_nt)->nt_nodelock.mtx)
96 #define IEEE80211_NODE_LOCK_DESTROY(_nt) \
97 mtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt))
98 #define IEEE80211_NODE_LOCK(_nt) \
99 mtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt))
100 #define IEEE80211_NODE_IS_LOCKED(_nt) \
101 mtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt))
102 #define IEEE80211_NODE_UNLOCK(_nt) \
103 mtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt))
104 #define IEEE80211_NODE_LOCK_ASSERT(_nt) \
105 mtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED)
108 * Node table iteration locking definitions; this protects the
109 * scan generation # used to iterate over the station table
110 * while grabbing+releasing the node lock.
113 char name[16]; /* e.g. "ath0_scan_lock" */
115 } ieee80211_scan_lock_t;
116 #define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \
117 ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \
118 snprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \
119 mtx_init(&sl->mtx, sl->name, NULL, MTX_DEF); \
121 #define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.mtx)
122 #define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \
123 mtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
124 #define IEEE80211_NODE_ITERATE_LOCK(_nt) \
125 mtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
126 #define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \
127 mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))
130 * Power-save queue definitions.
132 typedef struct mtx ieee80211_psq_lock_t;
133 #define IEEE80211_PSQ_INIT(_psq, _name) \
134 mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF)
135 #define IEEE80211_PSQ_DESTROY(_psq) mtx_destroy(&(_psq)->psq_lock)
136 #define IEEE80211_PSQ_LOCK(_psq) mtx_lock(&(_psq)->psq_lock)
137 #define IEEE80211_PSQ_UNLOCK(_psq) mtx_unlock(&(_psq)->psq_lock)
139 #ifndef IF_PREPEND_LIST
140 #define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
141 (mtail)->m_nextpkt = (ifq)->ifq_head; \
142 if ((ifq)->ifq_tail == NULL) \
143 (ifq)->ifq_tail = (mtail); \
144 (ifq)->ifq_head = (mhead); \
145 (ifq)->ifq_len += (mcount); \
147 #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \
149 _IF_PREPEND_LIST(ifq, mhead, mtail, mcount); \
152 #endif /* IF_PREPEND_LIST */
155 * Age queue definitions.
157 typedef struct mtx ieee80211_ageq_lock_t;
158 #define IEEE80211_AGEQ_INIT(_aq, _name) \
159 mtx_init(&(_aq)->aq_lock, _name, "802.11 age q", MTX_DEF)
160 #define IEEE80211_AGEQ_DESTROY(_aq) mtx_destroy(&(_aq)->aq_lock)
161 #define IEEE80211_AGEQ_LOCK(_aq) mtx_lock(&(_aq)->aq_lock)
162 #define IEEE80211_AGEQ_UNLOCK(_aq) mtx_unlock(&(_aq)->aq_lock)
165 * 802.1x MAC ACL database locking definitions.
167 typedef struct mtx acl_lock_t;
168 #define ACL_LOCK_INIT(_as, _name) \
169 mtx_init(&(_as)->as_lock, _name, "802.11 ACL", MTX_DEF)
170 #define ACL_LOCK_DESTROY(_as) mtx_destroy(&(_as)->as_lock)
171 #define ACL_LOCK(_as) mtx_lock(&(_as)->as_lock)
172 #define ACL_UNLOCK(_as) mtx_unlock(&(_as)->as_lock)
173 #define ACL_LOCK_ASSERT(_as) \
174 mtx_assert((&(_as)->as_lock), MA_OWNED)
177 * Scan table definitions.
179 typedef struct mtx ieee80211_scan_table_lock_t;
180 #define IEEE80211_SCAN_TABLE_LOCK_INIT(_st, _name) \
181 mtx_init(&(_st)->st_lock, _name, "802.11 scan table", MTX_DEF)
182 #define IEEE80211_SCAN_TABLE_LOCK_DESTROY(_st) mtx_destroy(&(_st)->st_lock)
183 #define IEEE80211_SCAN_TABLE_LOCK(_st) mtx_lock(&(_st)->st_lock)
184 #define IEEE80211_SCAN_TABLE_UNLOCK(_st) mtx_unlock(&(_st)->st_lock)
187 * Node reference counting definitions.
189 * ieee80211_node_initref initialize the reference count to 1
190 * ieee80211_node_incref add a reference
191 * ieee80211_node_decref remove a reference
192 * ieee80211_node_dectestref remove a reference and return 1 if this
193 * is the last reference, otherwise 0
194 * ieee80211_node_refcnt reference count for printing (only)
196 #include <machine/atomic.h>
198 #define ieee80211_node_initref(_ni) \
199 do { ((_ni)->ni_refcnt = 1); } while (0)
200 #define ieee80211_node_incref(_ni) \
201 atomic_add_int(&(_ni)->ni_refcnt, 1)
202 #define ieee80211_node_decref(_ni) \
203 atomic_subtract_int(&(_ni)->ni_refcnt, 1)
204 struct ieee80211_node;
205 int ieee80211_node_dectestref(struct ieee80211_node *ni);
206 #define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt
210 void ieee80211_drain_ifq(struct ifqueue *);
211 void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);
213 void ieee80211_vap_destroy(struct ieee80211vap *);
215 #define IFNET_IS_UP_RUNNING(_ifp) \
216 (((_ifp)->if_flags & IFF_UP) && \
217 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
219 #define msecs_to_ticks(ms) (((ms)*hz)/1000)
220 #define ticks_to_msecs(t) (1000*(t) / hz)
221 #define ticks_to_secs(t) ((t) / hz)
222 #define time_after(a,b) ((long)(b) - (long)(a) < 0)
223 #define time_before(a,b) time_after(b,a)
224 #define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
225 #define time_before_eq(a,b) time_after_eq(b,a)
227 struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);
230 #define M_ENCAP M_PROTO1 /* 802.11 encap done */
231 #define M_EAPOL M_PROTO3 /* PAE/EAPOL frame */
232 #define M_PWR_SAV M_PROTO4 /* bypass PS handling */
233 #define M_MORE_DATA M_PROTO5 /* more data frames to follow */
234 #define M_FF M_PROTO6 /* fast frame */
235 #define M_TXCB M_PROTO7 /* do tx complete callback */
236 #define M_AMPDU_MPDU M_PROTO8 /* ok for A-MPDU aggregation */
238 (M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\
239 M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU)
242 #define M_AMPDU M_PROTO1 /* A-MPDU subframe */
243 #define M_WEP M_PROTO2 /* WEP done by hardware */
245 #define M_AMPDU_MPDU M_PROTO8 /* A-MPDU re-order done */
247 #define M_80211_RX (M_AMPDU|M_WEP|M_AMPDU_MPDU)
249 #define IEEE80211_MBUF_TX_FLAG_BITS \
250 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_ENCAP\6M_WEP\7M_EAPOL" \
251 "\10M_PWR_SAV\11M_MORE_DATA\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \
252 "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \
253 "\23M_NOFREE\24M_FF\25M_TXCB\26M_AMPDU_MPDU\27M_FLOWID"
255 #define IEEE80211_MBUF_RX_FLAG_BITS \
256 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_AMPDU\6M_WEP\7M_PROTO3" \
257 "\10M_PROTO4\11M_PROTO5\12M_BCAST\13M_MCAST\14M_FRAG\15M_FIRSTFRAG" \
258 "\16M_LASTFRAG\17M_SKIP_FIREWALL\20M_FREELIST\21M_VLANTAG\22M_PROMISC" \
259 "\23M_NOFREE\24M_PROTO6\25M_PROTO7\26M_AMPDU_MPDU\27M_FLOWID"
262 * Store WME access control bits in the vlan tag.
263 * This is safe since it's done after the packet is classified
264 * (where we use any previous tag) and because it's passed
265 * directly in to the driver and there's no chance someone
266 * else will clobber them on us.
268 #define M_WME_SETAC(m, ac) \
269 ((m)->m_pkthdr.ether_vtag = (ac))
270 #define M_WME_GETAC(m) ((m)->m_pkthdr.ether_vtag)
273 * Mbufs on the power save queue are tagged with an age and
274 * timed out. We reuse the hardware checksum field in the
275 * mbuf packet header to store this data.
277 #define M_AGE_SET(m,v) (m->m_pkthdr.csum_data = v)
278 #define M_AGE_GET(m) (m->m_pkthdr.csum_data)
279 #define M_AGE_SUB(m,adj) (m->m_pkthdr.csum_data -= adj)
282 * Store the sequence number.
284 #define M_SEQNO_SET(m, seqno) \
285 ((m)->m_pkthdr.tso_segsz = (seqno))
286 #define M_SEQNO_GET(m) ((m)->m_pkthdr.tso_segsz)
288 #define MTAG_ABI_NET80211 1132948340 /* net80211 ABI */
290 struct ieee80211_cb {
291 void (*func)(struct ieee80211_node *, void *, int status);
294 #define NET80211_TAG_CALLBACK 0 /* xmit complete callback */
295 int ieee80211_add_callback(struct mbuf *m,
296 void (*func)(struct ieee80211_node *, void *, int), void *arg);
297 void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);
300 int ieee80211_parent_xmitpkt(struct ieee80211com *, struct mbuf *);
301 int ieee80211_vap_xmitpkt(struct ieee80211vap *, struct mbuf *);
303 void get_random_bytes(void *, size_t);
305 void ieee80211_sysctl_attach(struct ieee80211com *);
306 void ieee80211_sysctl_detach(struct ieee80211com *);
307 void ieee80211_sysctl_vattach(struct ieee80211vap *);
308 void ieee80211_sysctl_vdetach(struct ieee80211vap *);
310 SYSCTL_DECL(_net_wlan);
311 int ieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS);
313 void ieee80211_load_module(const char *);
316 * A "policy module" is an adjunct module to net80211 that provides
317 * functionality that typically includes policy decisions. This
318 * modularity enables extensibility and vendor-supplied functionality.
320 #define _IEEE80211_POLICY_MODULE(policy, name, version) \
321 typedef void (*policy##_setup)(int); \
322 SET_DECLARE(policy##_set, policy##_setup); \
324 wlan_##name##_modevent(module_t mod, int type, void *unused) \
326 policy##_setup * const *iter, f; \
329 SET_FOREACH(iter, policy##_set) { \
337 printf("wlan_##name: still in use (%u dynamic refs)\n",\
341 if (type == MOD_UNLOAD) { \
342 SET_FOREACH(iter, policy##_set) { \
351 static moduledata_t name##_mod = { \
353 wlan_##name##_modevent, \
356 DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
357 MODULE_VERSION(wlan_##name, version); \
358 MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)
361 * Crypto modules implement cipher support.
363 #define IEEE80211_CRYPTO_MODULE(name, version) \
364 _IEEE80211_POLICY_MODULE(crypto, name, version); \
366 name##_modevent(int type) \
368 if (type == MOD_LOAD) \
369 ieee80211_crypto_register(&name); \
371 ieee80211_crypto_unregister(&name); \
373 TEXT_SET(crypto##_set, name##_modevent)
376 * Scanner modules provide scanning policy.
378 #define IEEE80211_SCANNER_MODULE(name, version) \
379 _IEEE80211_POLICY_MODULE(scanner, name, version)
381 #define IEEE80211_SCANNER_ALG(name, alg, v) \
383 name##_modevent(int type) \
385 if (type == MOD_LOAD) \
386 ieee80211_scanner_register(alg, &v); \
388 ieee80211_scanner_unregister(alg, &v); \
390 TEXT_SET(scanner_set, name##_modevent); \
393 * ACL modules implement acl policy.
395 #define IEEE80211_ACL_MODULE(name, alg, version) \
396 _IEEE80211_POLICY_MODULE(acl, name, version); \
398 alg##_modevent(int type) \
400 if (type == MOD_LOAD) \
401 ieee80211_aclator_register(&alg); \
403 ieee80211_aclator_unregister(&alg); \
405 TEXT_SET(acl_set, alg##_modevent); \
408 * Authenticator modules handle 802.1x/WPA authentication.
410 #define IEEE80211_AUTH_MODULE(name, version) \
411 _IEEE80211_POLICY_MODULE(auth, name, version)
413 #define IEEE80211_AUTH_ALG(name, alg, v) \
415 name##_modevent(int type) \
417 if (type == MOD_LOAD) \
418 ieee80211_authenticator_register(alg, &v); \
420 ieee80211_authenticator_unregister(alg); \
422 TEXT_SET(auth_set, name##_modevent)
425 * Rate control modules provide tx rate control support.
427 #define IEEE80211_RATECTL_MODULE(alg, version) \
428 _IEEE80211_POLICY_MODULE(ratectl, alg, version); \
430 #define IEEE80211_RATECTL_ALG(name, alg, v) \
432 alg##_modevent(int type) \
434 if (type == MOD_LOAD) \
435 ieee80211_ratectl_register(alg, &v); \
437 ieee80211_ratectl_unregister(alg); \
439 TEXT_SET(ratectl##_set, alg##_modevent)
442 typedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,
443 struct ieee80211req *);
444 SET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc);
445 #define IEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get)
447 typedef int ieee80211_ioctl_setfunc(struct ieee80211vap *,
448 struct ieee80211req *);
449 SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);
450 #define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)
453 /* XXX this stuff belongs elsewhere */
455 * Message formats for messages from the net80211 layer to user
456 * applications via the routing socket. These messages are appended
457 * to an if_announcemsghdr structure.
459 struct ieee80211_join_event {
463 struct ieee80211_leave_event {
467 struct ieee80211_replay_event {
468 uint8_t iev_src[6]; /* src MAC */
469 uint8_t iev_dst[6]; /* dst MAC */
470 uint8_t iev_cipher; /* cipher type */
471 uint8_t iev_keyix; /* key id/index */
472 uint64_t iev_keyrsc; /* RSC from key */
473 uint64_t iev_rsc; /* RSC from frame */
476 struct ieee80211_michael_event {
477 uint8_t iev_src[6]; /* src MAC */
478 uint8_t iev_dst[6]; /* dst MAC */
479 uint8_t iev_cipher; /* cipher type */
480 uint8_t iev_keyix; /* key id/index */
483 struct ieee80211_wds_event {
487 struct ieee80211_csa_event {
488 uint32_t iev_flags; /* channel flags */
489 uint16_t iev_freq; /* setting in Mhz */
490 uint8_t iev_ieee; /* IEEE channel number */
491 uint8_t iev_mode; /* CSA mode */
492 uint8_t iev_count; /* CSA count */
495 struct ieee80211_cac_event {
496 uint32_t iev_flags; /* channel flags */
497 uint16_t iev_freq; /* setting in Mhz */
498 uint8_t iev_ieee; /* IEEE channel number */
500 uint8_t iev_type; /* IEEE80211_NOTIFY_CAC_* */
503 struct ieee80211_radar_event {
504 uint32_t iev_flags; /* channel flags */
505 uint16_t iev_freq; /* setting in Mhz */
506 uint8_t iev_ieee; /* IEEE channel number */
510 struct ieee80211_auth_event {
514 struct ieee80211_deauth_event {
518 struct ieee80211_country_event {
520 uint8_t iev_cc[2]; /* ISO country code */
523 struct ieee80211_radio_event {
524 uint8_t iev_state; /* 1 on, 0 off */
527 #define RTM_IEEE80211_ASSOC 100 /* station associate (bss mode) */
528 #define RTM_IEEE80211_REASSOC 101 /* station re-associate (bss mode) */
529 #define RTM_IEEE80211_DISASSOC 102 /* station disassociate (bss mode) */
530 #define RTM_IEEE80211_JOIN 103 /* station join (ap mode) */
531 #define RTM_IEEE80211_LEAVE 104 /* station leave (ap mode) */
532 #define RTM_IEEE80211_SCAN 105 /* scan complete, results available */
533 #define RTM_IEEE80211_REPLAY 106 /* sequence counter replay detected */
534 #define RTM_IEEE80211_MICHAEL 107 /* Michael MIC failure detected */
535 #define RTM_IEEE80211_REJOIN 108 /* station re-associate (ap mode) */
536 #define RTM_IEEE80211_WDS 109 /* WDS discovery (ap mode) */
537 #define RTM_IEEE80211_CSA 110 /* Channel Switch Announcement event */
538 #define RTM_IEEE80211_RADAR 111 /* radar event */
539 #define RTM_IEEE80211_CAC 112 /* Channel Availability Check event */
540 #define RTM_IEEE80211_DEAUTH 113 /* station deauthenticate */
541 #define RTM_IEEE80211_AUTH 114 /* station authenticate (ap mode) */
542 #define RTM_IEEE80211_COUNTRY 115 /* discovered country code (sta mode) */
543 #define RTM_IEEE80211_RADIO 116 /* RF kill switch state change */
546 * Structure prepended to raw packets sent through the bpf
547 * interface when set to DLT_IEEE802_11_RADIO. This allows
548 * user applications to specify pretty much everything in
549 * an Atheros tx descriptor. XXX need to generalize.
551 * XXX cannot be more than 14 bytes as it is copied to a sockaddr's
554 struct ieee80211_bpf_params {
555 uint8_t ibp_vers; /* version */
556 #define IEEE80211_BPF_VERSION 0
557 uint8_t ibp_len; /* header length in bytes */
559 #define IEEE80211_BPF_SHORTPRE 0x01 /* tx with short preamble */
560 #define IEEE80211_BPF_NOACK 0x02 /* tx with no ack */
561 #define IEEE80211_BPF_CRYPTO 0x04 /* tx with h/w encryption */
562 #define IEEE80211_BPF_FCS 0x10 /* frame incldues FCS */
563 #define IEEE80211_BPF_DATAPAD 0x20 /* frame includes data padding */
564 #define IEEE80211_BPF_RTS 0x40 /* tx with RTS/CTS */
565 #define IEEE80211_BPF_CTS 0x80 /* tx with CTS only */
566 uint8_t ibp_pri; /* WME/WMM AC+tx antenna */
567 uint8_t ibp_try0; /* series 1 try count */
568 uint8_t ibp_rate0; /* series 1 IEEE tx rate */
569 uint8_t ibp_power; /* tx power (device units) */
570 uint8_t ibp_ctsrate; /* IEEE tx rate for CTS */
571 uint8_t ibp_try1; /* series 2 try count */
572 uint8_t ibp_rate1; /* series 2 IEEE tx rate */
573 uint8_t ibp_try2; /* series 3 try count */
574 uint8_t ibp_rate2; /* series 3 IEEE tx rate */
575 uint8_t ibp_try3; /* series 4 try count */
576 uint8_t ibp_rate3; /* series 4 IEEE tx rate */
578 #endif /* _NET80211_IEEE80211_FREEBSD_H_ */