2 * Copyright (c) 2010 Broadcom Corporation
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.
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.
20 #include <linux/if_ether.h>
22 #define DOT11_A3_HDR_LEN 24
23 #define DOT11_A4_HDR_LEN 30
24 #define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
25 #define DOT11_FCS_LEN 4
26 #define DOT11_ICV_AES_LEN 8
27 #define DOT11_QOS_LEN 2
29 #define DOT11_IV_MAX_LEN 8
31 #define DOT11_MAX_SSID_LEN 32
33 #define DOT11_DEFAULT_RTS_LEN 2347
35 #define DOT11_MIN_FRAG_LEN 256
36 #define DOT11_MAX_FRAG_LEN 2346
37 #define DOT11_DEFAULT_FRAG_LEN 2346
39 #define DOT11_MIN_BEACON_PERIOD 1
40 #define DOT11_MAX_BEACON_PERIOD 0xFFFF
42 #define DOT11_MIN_DTIM_PERIOD 1
43 #define DOT11_MAX_DTIM_PERIOD 0xFF
45 #define DOT11_OUI_LEN 3
47 #define DOT11_RTS_LEN 16
48 #define DOT11_CTS_LEN 10
49 #define DOT11_ACK_LEN 10
51 #define DOT11_BA_BITMAP_LEN 128
52 #define DOT11_BA_LEN 4
54 #define DOT11_MGMT_HDR_LEN 24
56 struct dot11_bcn_prb {
60 } __attribute__((packed));
61 #define DOT11_BCN_PRB_LEN 12
63 #define WME_OUI "\x00\x50\xf2"
66 #define WME_SUBTYPE_PARAM_IE 1
74 typedef u8 ac_bitmap_t;
76 #define AC_BITMAP_ALL 0xf
77 #define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0)
83 } __attribute__((packed));
84 typedef struct edcf_acparam edcf_acparam_t;
93 edcf_acparam_t acparam[AC_COUNT];
94 } __attribute__((packed));
95 typedef struct wme_param_ie wme_param_ie_t;
96 #define WME_PARAM_IE_LEN 24
98 #define EDCF_AIFSN_MIN 1
99 #define EDCF_AIFSN_MAX 15
100 #define EDCF_AIFSN_MASK 0x0f
101 #define EDCF_ACM_MASK 0x10
102 #define EDCF_ACI_MASK 0x60
103 #define EDCF_ACI_SHIFT 5
105 #define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
106 #define EDCF_ECWMIN_MASK 0x0f
107 #define EDCF_ECWMAX_MASK 0xf0
108 #define EDCF_ECWMAX_SHIFT 4
110 #define EDCF_TXOP2USEC(txop) ((txop) << 5)
112 #define EDCF_AC_BE_ACI_STA 0x03
113 #define EDCF_AC_BE_ECW_STA 0xA4
114 #define EDCF_AC_BE_TXOP_STA 0x0000
115 #define EDCF_AC_BK_ACI_STA 0x27
116 #define EDCF_AC_BK_ECW_STA 0xA4
117 #define EDCF_AC_BK_TXOP_STA 0x0000
118 #define EDCF_AC_VI_ACI_STA 0x42
119 #define EDCF_AC_VI_ECW_STA 0x43
120 #define EDCF_AC_VI_TXOP_STA 0x005e
121 #define EDCF_AC_VO_ACI_STA 0x62
122 #define EDCF_AC_VO_ECW_STA 0x32
123 #define EDCF_AC_VO_TXOP_STA 0x002f
125 #define EDCF_AC_VO_TXOP_AP 0x002f
127 #define DOT11_OPEN_SYSTEM 0
128 #define DOT11_SHARED_KEY 1
130 #define FC_TYPE_MASK 0xC
131 #define FC_TYPE_SHIFT 2
132 #define FC_SUBTYPE_MASK 0xF0
133 #define FC_SUBTYPE_SHIFT 4
134 #define FC_MOREFRAG 0x400
136 #define SEQNUM_SHIFT 4
137 #define SEQNUM_MAX 0x1000
138 #define FRAGNUM_MASK 0xF
140 #define FC_TYPE_MNG 0
141 #define FC_TYPE_CTL 1
142 #define FC_TYPE_DATA 2
144 #define FC_SUBTYPE_PROBE_REQ 4
145 #define FC_SUBTYPE_PROBE_RESP 5
146 #define FC_SUBTYPE_BEACON 8
147 #define FC_SUBTYPE_PS_POLL 10
148 #define FC_SUBTYPE_RTS 11
149 #define FC_SUBTYPE_CTS 12
151 #define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)
153 #define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
155 #define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
157 #define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)
158 #define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)
160 #define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
161 #define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
162 #define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
163 #define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
164 #define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
165 #define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
167 #define TLV_LEN_OFF 1
168 #define TLV_HDR_LEN 2
169 #define TLV_BODY_OFF 2
171 #define DOT11_MNG_RSN_ID 48
172 #define DOT11_MNG_WPA_ID 221
173 #define DOT11_MNG_VS_ID 221
175 #define DOT11_CAP_ESS 0x0001
176 #define DOT11_CAP_IBSS 0x0002
177 #define DOT11_CAP_PRIVACY 0x0010
178 #define DOT11_CAP_SHORT 0x0020
179 #define DOT11_CAP_SHORTSLOT 0x0400
181 #define DOT11_BSSTYPE_INFRASTRUCTURE 0
182 #define DOT11_BSSTYPE_ANY 2
183 #define DOT11_SCANTYPE_ACTIVE 0
185 #define PREN_PREAMBLE 24
186 #define PREN_MM_EXT 12
187 #define PREN_PREAMBLE_EXT 4
189 #define RIFS_11N_TIME 2
191 #define APHY_SLOT_TIME 9
192 #define APHY_SIFS_TIME 16
193 #define APHY_PREAMBLE_TIME 16
194 #define APHY_SIGNAL_TIME 4
195 #define APHY_SYMBOL_TIME 4
196 #define APHY_SERVICE_NBITS 16
197 #define APHY_TAIL_NBITS 6
198 #define APHY_CWMIN 15
200 #define BPHY_SLOT_TIME 20
201 #define BPHY_SIFS_TIME 10
202 #define BPHY_PLCP_TIME 192
203 #define BPHY_PLCP_SHORT_TIME 96
205 #define DOT11_OFDM_SIGNAL_EXTENSION 6
207 #define PHY_CWMAX 1023
209 #define DOT11_MAXNUMFRAGS 16
211 typedef struct d11cnt {
228 #define MCSSET_LEN 16
233 u8 supp_mcs[MCSSET_LEN];
237 } __attribute__((packed));
238 typedef struct ht_cap_ie ht_cap_ie_t;
240 #define HT_CAP_IE_LEN 26
242 #define HT_CAP_LDPC_CODING 0x0001
243 #define HT_CAP_40MHZ 0x0002
244 #define HT_CAP_MIMO_PS_MASK 0x000C
245 #define HT_CAP_MIMO_PS_SHIFT 0x0002
246 #define HT_CAP_MIMO_PS_OFF 0x0003
247 #define HT_CAP_MIMO_PS_ON 0x0000
248 #define HT_CAP_GF 0x0010
249 #define HT_CAP_SHORT_GI_20 0x0020
250 #define HT_CAP_SHORT_GI_40 0x0040
251 #define HT_CAP_TX_STBC 0x0080
252 #define HT_CAP_RX_STBC_MASK 0x0300
253 #define HT_CAP_RX_STBC_SHIFT 8
254 #define HT_CAP_MAX_AMSDU 0x0800
255 #define HT_CAP_DSSS_CCK 0x1000
256 #define HT_CAP_40MHZ_INTOLERANT 0x4000
258 #define HT_CAP_RX_STBC_NO 0x0
259 #define HT_CAP_RX_STBC_ONE_STREAM 0x1
261 #define HT_PARAMS_RX_FACTOR_MASK 0x03
263 #define AMPDU_MAX_MPDU_DENSITY 7
264 #define AMPDU_RX_FACTOR_16K 1
265 #define AMPDU_RX_FACTOR_32K 2
266 #define AMPDU_RX_FACTOR_64K 3
268 #define AMPDU_DELIMITER_LEN 4
270 #define DOT11N_TXBURST 0x0008
272 #define WPA_VERSION 1
273 #define WPA_OUI "\x00\x50\xF2"
275 #define WFA_OUI "\x00\x50\xF2"
276 #define WFA_OUI_LEN 3
278 #define WFA_OUI_TYPE_WPA 1
280 #define RSN_AKM_NONE 0
281 #define RSN_AKM_UNSPECIFIED 1
282 #define RSN_AKM_PSK 2
284 #define DOT11_MAX_DEFAULT_KEYS 4
285 #define DOT11_MAX_KEY_SIZE 32
286 #define DOT11_WPA_KEY_RSC_LEN 8
288 #define WEP1_KEY_SIZE 5
289 #define WEP128_KEY_SIZE 13
290 #define TKIP_KEY_SIZE 32
291 #define AES_KEY_SIZE 16
293 #define BRCM_OUI "\x00\x10\x18"
295 #endif /* _802_11_H_ */