Commit | Line | Data |
---|---|---|
a9533e7e HP |
1 | /* |
2 | * Copyright (c) 2010 Broadcom Corporation | |
3 | * | |
4 | * Permission to use, copy, modify, and/or distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice appear in all copies. | |
7 | * | |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
15 | */ | |
16 | ||
17 | #ifndef _802_11_H_ | |
18 | #define _802_11_H_ | |
19 | ||
a9533e7e | 20 | #include <typedefs.h> |
a9533e7e | 21 | #include <proto/wpa.h> |
a9533e7e HP |
22 | #include <packed_section_start.h> |
23 | ||
a9533e7e HP |
24 | #define DOT11_A3_HDR_LEN 24 |
25 | #define DOT11_A4_HDR_LEN 30 | |
26 | #define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN | |
27 | #define DOT11_FCS_LEN 4 | |
a9533e7e HP |
28 | #define DOT11_ICV_AES_LEN 8 |
29 | #define DOT11_QOS_LEN 2 | |
a9533e7e | 30 | |
a9533e7e HP |
31 | #define DOT11_IV_MAX_LEN 8 |
32 | ||
a9533e7e HP |
33 | #define DOT11_MAX_SSID_LEN 32 |
34 | ||
35 | #define DOT11_DEFAULT_RTS_LEN 2347 | |
a9533e7e HP |
36 | |
37 | #define DOT11_MIN_FRAG_LEN 256 | |
38 | #define DOT11_MAX_FRAG_LEN 2346 | |
39 | #define DOT11_DEFAULT_FRAG_LEN 2346 | |
40 | ||
41 | #define DOT11_MIN_BEACON_PERIOD 1 | |
42 | #define DOT11_MAX_BEACON_PERIOD 0xFFFF | |
43 | ||
44 | #define DOT11_MIN_DTIM_PERIOD 1 | |
45 | #define DOT11_MAX_DTIM_PERIOD 0xFF | |
46 | ||
a9533e7e | 47 | #define DOT11_OUI_LEN 3 |
a9533e7e HP |
48 | |
49 | BWL_PRE_PACKED_STRUCT struct dot11_header { | |
50 | uint16 fc; | |
51 | uint16 durid; | |
52 | struct ether_addr a1; | |
53 | struct ether_addr a2; | |
54 | struct ether_addr a3; | |
55 | uint16 seq; | |
56 | struct ether_addr a4; | |
57 | } BWL_POST_PACKED_STRUCT; | |
58 | ||
59 | BWL_PRE_PACKED_STRUCT struct dot11_rts_frame { | |
60 | uint16 fc; | |
61 | uint16 durid; | |
62 | struct ether_addr ra; | |
63 | struct ether_addr ta; | |
64 | } BWL_POST_PACKED_STRUCT; | |
a9533e7e | 65 | |
34a5fa94 | 66 | #define DOT11_RTS_LEN 16 |
a9533e7e | 67 | #define DOT11_CTS_LEN 10 |
a9533e7e HP |
68 | #define DOT11_ACK_LEN 10 |
69 | ||
34a5fa94 | 70 | #define DOT11_BA_BITMAP_LEN 128 |
a9533e7e HP |
71 | #define DOT11_BA_LEN 4 |
72 | ||
73 | BWL_PRE_PACKED_STRUCT struct dot11_management_header { | |
74 | uint16 fc; | |
75 | uint16 durid; | |
76 | struct ether_addr da; | |
77 | struct ether_addr sa; | |
78 | struct ether_addr bssid; | |
79 | uint16 seq; | |
80 | } BWL_POST_PACKED_STRUCT; | |
81 | #define DOT11_MGMT_HDR_LEN 24 | |
82 | ||
83 | BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb { | |
84 | uint32 timestamp[2]; | |
85 | uint16 beacon_interval; | |
86 | uint16 capability; | |
87 | } BWL_POST_PACKED_STRUCT; | |
88 | #define DOT11_BCN_PRB_LEN 12 | |
a9533e7e HP |
89 | |
90 | #define WME_OUI "\x00\x50\xf2" | |
91 | #define WME_VER 1 | |
92 | #define WME_TYPE 2 | |
a9533e7e | 93 | #define WME_SUBTYPE_PARAM_IE 1 |
a9533e7e HP |
94 | |
95 | #define AC_BE 0 | |
96 | #define AC_BK 1 | |
97 | #define AC_VI 2 | |
98 | #define AC_VO 3 | |
99 | #define AC_COUNT 4 | |
100 | ||
101 | typedef uint8 ac_bitmap_t; | |
102 | ||
a9533e7e HP |
103 | #define AC_BITMAP_ALL 0xf |
104 | #define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0) | |
a9533e7e HP |
105 | |
106 | BWL_PRE_PACKED_STRUCT struct edcf_acparam { | |
107 | uint8 ACI; | |
108 | uint8 ECW; | |
109 | uint16 TXOP; | |
110 | } BWL_POST_PACKED_STRUCT; | |
111 | typedef struct edcf_acparam edcf_acparam_t; | |
112 | ||
113 | BWL_PRE_PACKED_STRUCT struct wme_param_ie { | |
114 | uint8 oui[3]; | |
115 | uint8 type; | |
116 | uint8 subtype; | |
117 | uint8 version; | |
118 | uint8 qosinfo; | |
119 | uint8 rsvd; | |
120 | edcf_acparam_t acparam[AC_COUNT]; | |
121 | } BWL_POST_PACKED_STRUCT; | |
122 | typedef struct wme_param_ie wme_param_ie_t; | |
123 | #define WME_PARAM_IE_LEN 24 | |
124 | ||
a9533e7e HP |
125 | #define EDCF_AIFSN_MIN 1 |
126 | #define EDCF_AIFSN_MAX 15 | |
127 | #define EDCF_AIFSN_MASK 0x0f | |
128 | #define EDCF_ACM_MASK 0x10 | |
129 | #define EDCF_ACI_MASK 0x60 | |
130 | #define EDCF_ACI_SHIFT 5 | |
a9533e7e | 131 | |
a9533e7e HP |
132 | #define EDCF_ECW2CW(exp) ((1 << (exp)) - 1) |
133 | #define EDCF_ECWMIN_MASK 0x0f | |
134 | #define EDCF_ECWMAX_MASK 0xf0 | |
135 | #define EDCF_ECWMAX_SHIFT 4 | |
136 | ||
a9533e7e HP |
137 | #define EDCF_TXOP2USEC(txop) ((txop) << 5) |
138 | ||
a9533e7e HP |
139 | #define EDCF_AC_BE_ACI_STA 0x03 |
140 | #define EDCF_AC_BE_ECW_STA 0xA4 | |
141 | #define EDCF_AC_BE_TXOP_STA 0x0000 | |
142 | #define EDCF_AC_BK_ACI_STA 0x27 | |
143 | #define EDCF_AC_BK_ECW_STA 0xA4 | |
144 | #define EDCF_AC_BK_TXOP_STA 0x0000 | |
145 | #define EDCF_AC_VI_ACI_STA 0x42 | |
146 | #define EDCF_AC_VI_ECW_STA 0x43 | |
147 | #define EDCF_AC_VI_TXOP_STA 0x005e | |
148 | #define EDCF_AC_VO_ACI_STA 0x62 | |
149 | #define EDCF_AC_VO_ECW_STA 0x32 | |
150 | #define EDCF_AC_VO_TXOP_STA 0x002f | |
151 | ||
a9533e7e HP |
152 | #define EDCF_AC_VO_TXOP_AP 0x002f |
153 | ||
a9533e7e HP |
154 | #define DOT11_OPEN_SYSTEM 0 |
155 | #define DOT11_SHARED_KEY 1 | |
a9533e7e | 156 | |
a9533e7e HP |
157 | #define FC_TYPE_MASK 0xC |
158 | #define FC_TYPE_SHIFT 2 | |
159 | #define FC_SUBTYPE_MASK 0xF0 | |
160 | #define FC_SUBTYPE_SHIFT 4 | |
a9533e7e | 161 | #define FC_MOREFRAG 0x400 |
a9533e7e HP |
162 | |
163 | #define SEQNUM_SHIFT 4 | |
164 | #define SEQNUM_MAX 0x1000 | |
165 | #define FRAGNUM_MASK 0xF | |
166 | ||
167 | #define FC_TYPE_MNG 0 | |
168 | #define FC_TYPE_CTL 1 | |
169 | #define FC_TYPE_DATA 2 | |
170 | ||
a9533e7e HP |
171 | #define FC_SUBTYPE_PROBE_REQ 4 |
172 | #define FC_SUBTYPE_PROBE_RESP 5 | |
173 | #define FC_SUBTYPE_BEACON 8 | |
a9533e7e HP |
174 | #define FC_SUBTYPE_PS_POLL 10 |
175 | #define FC_SUBTYPE_RTS 11 | |
176 | #define FC_SUBTYPE_CTS 12 | |
a9533e7e HP |
177 | |
178 | #define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0) | |
a9533e7e HP |
179 | |
180 | #define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) | |
181 | ||
182 | #define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) | |
183 | ||
184 | #define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT) | |
185 | #define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT) | |
186 | ||
a9533e7e HP |
187 | #define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) |
188 | #define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) | |
189 | #define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) | |
a9533e7e HP |
190 | #define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) |
191 | #define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) | |
192 | #define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) | |
34a5fa94 | 193 | |
a9533e7e HP |
194 | #define TLV_LEN_OFF 1 |
195 | #define TLV_HDR_LEN 2 | |
196 | #define TLV_BODY_OFF 2 | |
197 | ||
a9533e7e | 198 | #define DOT11_MNG_RSN_ID 48 |
a9533e7e | 199 | #define DOT11_MNG_WPA_ID 221 |
a9533e7e HP |
200 | #define DOT11_MNG_VS_ID 221 |
201 | ||
a9533e7e HP |
202 | #define DOT11_CAP_ESS 0x0001 |
203 | #define DOT11_CAP_IBSS 0x0002 | |
a9533e7e HP |
204 | #define DOT11_CAP_PRIVACY 0x0010 |
205 | #define DOT11_CAP_SHORT 0x0020 | |
a9533e7e | 206 | #define DOT11_CAP_SHORTSLOT 0x0400 |
a9533e7e HP |
207 | |
208 | #define DOT11_BSSTYPE_INFRASTRUCTURE 0 | |
a9533e7e HP |
209 | #define DOT11_BSSTYPE_ANY 2 |
210 | #define DOT11_SCANTYPE_ACTIVE 0 | |
a9533e7e HP |
211 | |
212 | #define PREN_PREAMBLE 24 | |
213 | #define PREN_MM_EXT 12 | |
214 | #define PREN_PREAMBLE_EXT 4 | |
215 | ||
216 | #define RIFS_11N_TIME 2 | |
217 | ||
218 | #define APHY_SLOT_TIME 9 | |
219 | #define APHY_SIFS_TIME 16 | |
a9533e7e HP |
220 | #define APHY_PREAMBLE_TIME 16 |
221 | #define APHY_SIGNAL_TIME 4 | |
222 | #define APHY_SYMBOL_TIME 4 | |
223 | #define APHY_SERVICE_NBITS 16 | |
224 | #define APHY_TAIL_NBITS 6 | |
225 | #define APHY_CWMIN 15 | |
226 | ||
227 | #define BPHY_SLOT_TIME 20 | |
228 | #define BPHY_SIFS_TIME 10 | |
a9533e7e HP |
229 | #define BPHY_PLCP_TIME 192 |
230 | #define BPHY_PLCP_SHORT_TIME 96 | |
a9533e7e HP |
231 | |
232 | #define DOT11_OFDM_SIGNAL_EXTENSION 6 | |
233 | ||
234 | #define PHY_CWMAX 1023 | |
235 | ||
236 | #define DOT11_MAXNUMFRAGS 16 | |
237 | ||
238 | typedef struct d11cnt { | |
239 | uint32 txfrag; | |
240 | uint32 txmulti; | |
241 | uint32 txfail; | |
242 | uint32 txretry; | |
243 | uint32 txretrie; | |
244 | uint32 rxdup; | |
245 | uint32 txrts; | |
246 | uint32 txnocts; | |
247 | uint32 txnoack; | |
248 | uint32 rxfrag; | |
249 | uint32 rxmulti; | |
250 | uint32 rxcrc; | |
251 | uint32 txfrmsnt; | |
252 | uint32 rxundec; | |
253 | } d11cnt_t; | |
254 | ||
a9533e7e | 255 | #define MCSSET_LEN 16 |
a9533e7e HP |
256 | |
257 | BWL_PRE_PACKED_STRUCT struct ht_cap_ie { | |
258 | uint16 cap; | |
259 | uint8 params; | |
260 | uint8 supp_mcs[MCSSET_LEN]; | |
261 | uint16 ext_htcap; | |
262 | uint32 txbf_cap; | |
263 | uint8 as_cap; | |
264 | } BWL_POST_PACKED_STRUCT; | |
265 | typedef struct ht_cap_ie ht_cap_ie_t; | |
266 | ||
267 | #define HT_CAP_IE_LEN 26 | |
a9533e7e HP |
268 | |
269 | #define HT_CAP_LDPC_CODING 0x0001 | |
270 | #define HT_CAP_40MHZ 0x0002 | |
271 | #define HT_CAP_MIMO_PS_MASK 0x000C | |
272 | #define HT_CAP_MIMO_PS_SHIFT 0x0002 | |
273 | #define HT_CAP_MIMO_PS_OFF 0x0003 | |
a9533e7e HP |
274 | #define HT_CAP_MIMO_PS_ON 0x0000 |
275 | #define HT_CAP_GF 0x0010 | |
276 | #define HT_CAP_SHORT_GI_20 0x0020 | |
277 | #define HT_CAP_SHORT_GI_40 0x0040 | |
278 | #define HT_CAP_TX_STBC 0x0080 | |
279 | #define HT_CAP_RX_STBC_MASK 0x0300 | |
280 | #define HT_CAP_RX_STBC_SHIFT 8 | |
a9533e7e HP |
281 | #define HT_CAP_MAX_AMSDU 0x0800 |
282 | #define HT_CAP_DSSS_CCK 0x1000 | |
a9533e7e | 283 | #define HT_CAP_40MHZ_INTOLERANT 0x4000 |
a9533e7e HP |
284 | |
285 | #define HT_CAP_RX_STBC_NO 0x0 | |
286 | #define HT_CAP_RX_STBC_ONE_STREAM 0x1 | |
a9533e7e HP |
287 | |
288 | #define HT_PARAMS_RX_FACTOR_MASK 0x03 | |
a9533e7e HP |
289 | |
290 | #define AMPDU_MAX_MPDU_DENSITY 7 | |
a9533e7e HP |
291 | #define AMPDU_RX_FACTOR_16K 1 |
292 | #define AMPDU_RX_FACTOR_32K 2 | |
293 | #define AMPDU_RX_FACTOR_64K 3 | |
a9533e7e HP |
294 | |
295 | #define AMPDU_DELIMITER_LEN 4 | |
296 | ||
a9533e7e | 297 | #define DOT11N_TXBURST 0x0008 |
a9533e7e HP |
298 | |
299 | #define WPA_VERSION 1 | |
300 | #define WPA_OUI "\x00\x50\xF2" | |
301 | ||
a9533e7e HP |
302 | #define WFA_OUI "\x00\x50\xF2" |
303 | #define WFA_OUI_LEN 3 | |
304 | ||
305 | #define WFA_OUI_TYPE_WPA 1 | |
a9533e7e HP |
306 | |
307 | #define RSN_AKM_NONE 0 | |
308 | #define RSN_AKM_UNSPECIFIED 1 | |
309 | #define RSN_AKM_PSK 2 | |
310 | ||
311 | #define DOT11_MAX_DEFAULT_KEYS 4 | |
312 | #define DOT11_MAX_KEY_SIZE 32 | |
a9533e7e HP |
313 | #define DOT11_WPA_KEY_RSC_LEN 8 |
314 | ||
315 | #define WEP1_KEY_SIZE 5 | |
a9533e7e | 316 | #define WEP128_KEY_SIZE 13 |
a9533e7e | 317 | #define TKIP_KEY_SIZE 32 |
a9533e7e | 318 | #define AES_KEY_SIZE 16 |
a9533e7e | 319 | |
cf2b4488 | 320 | #define BRCM_OUI "\x00\x10\x18" |
a9533e7e HP |
321 | #include <packed_section_end.h> |
322 | ||
323 | #endif /* _802_11_H_ */ |