2 * Copyright (c) 2013 Qualcomm Atheros, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted (subject to the limitations in the
7 * disclaimer below) provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
17 * * Neither the name of Qualcomm Atheros nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
22 * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef _NET80211_IEEE80211_VAR_H_
37 #define _NET80211_IEEE80211_VAR_H_
39 #include"ieee80211_linux.h"
40 #include <asf_bitmap.h>
41 #include"_ieee80211.h"
43 #include"ieee80211_node.h"
46 #define ieee80211_tgt_free_nbuf( _nbuf) adf_nbuf_free( _nbuf)
48 * Built-in implementation for local skb free. Only interesting for platforms
49 * that pass skbs between OS instances.
51 #define ieee80211_tgt_free_local_nbuf( _nbuf) ieee80211_tgt_free_nbuf( _nbuf)
54 #define IEEE80211_ADDR_EQ(a1,a2) (adf_os_mem_cmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
55 #define IEEE80211_ADDR_COPY(dst,src) adf_os_mem_copy(dst, src, IEEE80211_ADDR_LEN)
58 #define IEEE80211_F_FF 0x00000001 /* CONF: ATH FF enabled */
59 #define IEEE80211_F_TURBOP 0x00000002 /* CONF: ATH Turbo enabled*/
60 #define IEEE80211_F_PROMISC 0x00000004 /* STATUS: promiscuous mode */
61 #define IEEE80211_F_ALLMULTI 0x00000008 /* STATUS: all multicast mode */
62 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */
63 #define IEEE80211_F_PRIVACY 0x00000010 /* CONF: privacy enabled */
64 #define IEEE80211_F_PUREG 0x00000020 /* CONF: 11g w/o 11b sta's */
65 #define IEEE80211_F_XRUPDATE 0x00000040 /* CONF: update beacon XR element*/
66 #define IEEE80211_F_SCAN 0x00000080 /* STATUS: scanning */
67 #define IEEE80211_F_XR 0x00000100 /* CONF: operate in XR mode */
68 #define IEEE80211_F_SIBSS 0x00000200 /* STATUS: start IBSS */
69 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */
70 #define IEEE80211_F_SHSLOT 0x00000400 /* STATUS: use short slot time*/
71 #define IEEE80211_F_PMGTON 0x00000800 /* CONF: Power mgmt enable */
72 #define IEEE80211_F_DESBSSID 0x00001000 /* CONF: des_bssid is set */
73 #define IEEE80211_F_WME 0x00002000 /* CONF: enable WME use */
74 #define IEEE80211_F_BGSCAN 0x00004000 /* CONF: bg scan enabled */
75 #define IEEE80211_F_SWRETRY 0x00008000 /* CONF: sw tx retry enabled */
76 #define IEEE80211_F_TXPOW_FIXED 0x00010000 /* TX Power: fixed rate */
77 #define IEEE80211_F_IBSSON 0x00020000 /* CONF: IBSS creation enable */
78 #define IEEE80211_F_SHPREAMBLE 0x00040000 /* STATUS: use short preamble */
79 #define IEEE80211_F_DATAPAD 0x00080000 /* CONF: do alignment pad */
80 #define IEEE80211_F_USEPROT 0x00100000 /* STATUS: protection enabled */
81 #define IEEE80211_F_USEBARKER 0x00200000 /* STATUS: use barker preamble*/
82 #define IEEE80211_F_TIMUPDATE 0x00400000 /* STATUS: update beacon tim */
83 #define IEEE80211_F_WPA1 0x00800000 /* CONF: WPA enabled */
84 #define IEEE80211_F_WPA2 0x01000000 /* CONF: WPA2 enabled */
85 #define IEEE80211_F_WPA 0x01800000 /* CONF: WPA/WPA2 enabled */
86 #define IEEE80211_F_DROPUNENC 0x02000000 /* CONF: drop unencrypted */
87 #define IEEE80211_F_COUNTERM 0x04000000 /* CONF: TKIP countermeasures */
88 #define IEEE80211_F_HIDESSID 0x08000000 /* CONF: hide SSID in beacon */
89 #define IEEE80211_F_NOBRIDGE 0x10000000 /* CONF: disable internal bridge */
90 #define IEEE80211_F_WMEUPDATE 0x20000000 /* STATUS: update beacon wme */
91 #define IEEE80211_F_DOTH 0x40000000 /* enable 11.h */
92 #define IEEE80211_F_CHANSWITCH 0x80000000 /* force chanswitch */
95 #define IEEE80211_FEXT_WDS 0x00000001 /* CONF: 4 addr allowed */
96 #define IEEE80211_FEXT_COUNTRYIE 0x00000002 /* CONF: enable country IE */
97 #define IEEE80211_FEXT_SCAN_PENDING 0x00000004 /* STATE: scan pending */
98 #define IEEE80211_FEXT_BGSCAN 0x00000008 /* STATE: enable full bgscan completion */
99 #define IEEE80211_FEXT_UAPSD 0x00000010 /* CONF: enable U-APSD */
100 #define IEEE80211_FEXT_SLEEP 0x00000020 /* STATUS: sleeping */
101 #define IEEE80211_FEXT_EOSPDROP 0x00000040 /* drop uapsd EOSP frames for test */
102 #define IEEE80211_FEXT_MARKDFS 0x00000080 /* Enable marking of dfs interfernce */
103 #define IEEE80211_FEXT_REGCLASS 0x00000100 /* CONF: send regclassids in country ie */
104 #define IEEE80211_FEXT_MARKDFS 0x00000080 /* Enable marking of dfs interfernce */
105 #define IEEE80211_FEXT_ERPUPDATE 0x00000200 /* STATUS: update ERP element */
106 #define IEEE80211_FEXT_SWBMISS 0x00000400 /* CONF: use software beacon timer */
107 #define IEEE80211_FEXT_BLKDFSCHAN 0x00000800 /* CONF: block the use of DFS channels */
108 #define IEEE80211_FEXT_APPIE_UPDATE 0x00001000 /* STATE: beacon APP IE updated */
109 #define IEEE80211_FAST_CC 0x00002000 /* CONF: Fast channel change */
110 #define IEEE80211_C_AMPDU 0x00004000 /* CONF: A-MPDU supported */
111 #define IEEE80211_C_AMSDU 0x00008000 /* CONF: A-MSDU supported */
112 #define IEEE80211_C_HTPROT 0x00010000 /* CONF: HT traffic protected */
113 #define IEEE80211_C_RESET 0x00020000 /* CONF: Reset once */
114 #define IEEE80211_F_NONHT_AP 0x00040000 /* STATUS: HT traffic protected */
115 #define IEEE80211_FEXT_HTUPDATE 0x00080000 /* STATUS: update HT element */
116 #define IEEE80211_C_WDS_AUTODETECT 0x00100000 /* CONF: WDS auto Detect/DELBA */
117 #define IEEE80211_C_RB 0x00200000 /* CONF: RB control */
118 #define IEEE80211_C_RB_DETECT 0x00400000 /* CONF: RB auto detection */
119 #define IEEE80211_C_NO_HTIE 0x00800000 /* CONF: No HT IE sending/parsing */
122 #define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */
123 #define IEEE80211_C_TKIP 0x00000002 /* CAPABILITY: TKIP available */
124 #define IEEE80211_C_AES 0x00000004 /* CAPABILITY: AES OCB avail */
125 #define IEEE80211_C_AES_CCM 0x00000008 /* CAPABILITY: AES CCM avail */
126 #define IEEE80211_C_CKIP 0x00000020 /* CAPABILITY: CKIP available */
127 #define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */
128 #define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/
129 #define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */
130 #define IEEE80211_C_PMGT 0x00000200 /* CAPABILITY: Power mgmt */
131 #define IEEE80211_C_HOSTAP 0x00000400 /* CAPABILITY: HOSTAP avail */
132 #define IEEE80211_C_AHDEMO 0x00000800 /* CAPABILITY: Old Adhoc Demo */
133 #define IEEE80211_C_SWRETRY 0x00001000 /* CAPABILITY: sw tx retry */
134 #define IEEE80211_C_TXPMGT 0x00002000 /* CAPABILITY: tx power mgmt */
135 #define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */
136 #define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */
137 #define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */
138 #define IEEE80211_C_TKIPMIC 0x00020000 /* CAPABILITY: TKIP MIC avail */
139 #define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */
140 #define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */
141 #define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/
142 #define IEEE80211_C_BURST 0x02000000 /* CAPABILITY: frame bursting */
143 #define IEEE80211_C_WME 0x04000000 /* CAPABILITY: WME avail */
144 #define IEEE80211_C_WDS 0x08000000 /* CAPABILITY: 4-addr support */
145 #define IEEE80211_C_WME_TKIPMIC 0x10000000 /* CAPABILITY: TKIP MIC for QoS frame */
146 #define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */
147 #define IEEE80211_C_UAPSD 0x40000000 /* CAPABILITY: UAPSD */
148 #define IEEE80211_C_FASTCC 0x80000000 /* CAPABILITY: fast channel change */
150 /* XXX protection/barker? */
152 #define IEEE80211_C_CRYPTO 0x0000002f /* CAPABILITY: crypto alg's */
154 /* Atheros ABOLT definitions */
155 #define IEEE80211_ABOLT_TURBO_G 0x01 /* Legacy Turbo G */
156 #define IEEE80211_ABOLT_TURBO_PRIME 0x02 /* Turbo Prime */
157 #define IEEE80211_ABOLT_COMPRESSION 0x04 /* Compression */
158 #define IEEE80211_ABOLT_FAST_FRAME 0x08 /* Fast Frames */
159 #define IEEE80211_ABOLT_BURST 0x10 /* Bursting */
160 #define IEEE80211_ABOLT_WME_ELE 0x20 /* WME based cwmin/max/burst tuning */
161 #define IEEE80211_ABOLT_XR 0x40 /* XR */
162 #define IEEE80211_ABOLT_AR 0x80 /* AR switches out based on adjaced non-turbo traffic */
164 /* Atheros Advanced Capabilities ABOLT definition */
165 #define IEEE80211_ABOLT_ADVCAP (IEEE80211_ABOLT_TURBO_PRIME | \
166 IEEE80211_ABOLT_COMPRESSION | \
167 IEEE80211_ABOLT_FAST_FRAME | \
168 IEEE80211_ABOLT_XR | \
169 IEEE80211_ABOLT_AR | \
170 IEEE80211_ABOLT_BURST | \
171 IEEE80211_ABOLT_WME_ELE)
173 /* check if a capability was negotiated for use */
174 #define IEEE80211_ATH_CAP(vap, ni, bit) \
175 ((ni)->ni_ath_flags & (vap)->iv_ath_cap & (bit))
177 /* flags to VAP create function */
178 #define IEEE80211_VAP_XR 0x10000 /* create a XR VAP without registering net device with OS*/
181 #define IEEE80211_HTF_SHORTGI 0x0001
184 /*************** Utility Routines ***/
186 * Return the size of the 802.11 header for a management or data frame.
188 static __inline a_int32_t
189 ieee80211_hdrsize(const void *data)
191 const struct ieee80211_frame *wh = data;
192 a_int32_t size = sizeof(struct ieee80211_frame);
194 /* NB: we don't handle control frames */
195 adf_os_assert((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL);
196 if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
197 size += IEEE80211_ADDR_LEN;
198 if (IEEE80211_QOS_HAS_SEQ(wh))
199 size += sizeof(a_uint16_t);
204 * Like ieee80211_hdrsize, but handles any type of frame.
206 static __inline a_int32_t
207 ieee80211_anyhdrsize(const void *data)
209 const struct ieee80211_frame *wh = data;
211 if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
212 switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) {
213 case IEEE80211_FC0_SUBTYPE_CTS:
214 case IEEE80211_FC0_SUBTYPE_ACK:
215 return sizeof(struct ieee80211_frame_ack);
217 return sizeof(struct ieee80211_frame_min);
219 return ieee80211_hdrsize(data);