This source file includes following definitions.
- lower_20_sb
- upper_20_sb
- chspec_bandunit
- ch20mhz_chspec
- next_20mhz_chan
- ac_bitmap_tst
1
2
3
4
5
6 #ifndef _BRCMU_WIFI_H_
7 #define _BRCMU_WIFI_H_
8
9 #include <linux/if_ether.h>
10 #include <linux/ieee80211.h>
11
12
13
14
15
16
17
18 #define CH_UPPER_SB 0x01
19 #define CH_LOWER_SB 0x02
20 #define CH_EWA_VALID 0x04
21 #define CH_70MHZ_APART 14
22 #define CH_50MHZ_APART 10
23 #define CH_30MHZ_APART 6
24 #define CH_20MHZ_APART 4
25 #define CH_10MHZ_APART 2
26 #define CH_5MHZ_APART 1
27 #define CH_MIN_2G_CHANNEL 1
28 #define CH_MAX_2G_CHANNEL 14
29 #define CH_MIN_5G_CHANNEL 34
30
31
32 #define BAND_2G_INDEX 0
33 #define BAND_5G_INDEX 1
34
35
36
37
38
39
40 #define MAXCHANNEL 224
41
42 #define WL_CHANSPEC_CHAN_MASK 0x00ff
43 #define WL_CHANSPEC_CHAN_SHIFT 0
44
45 #define WL_CHANSPEC_CTL_SB_MASK 0x0300
46 #define WL_CHANSPEC_CTL_SB_SHIFT 8
47 #define WL_CHANSPEC_CTL_SB_LOWER 0x0100
48 #define WL_CHANSPEC_CTL_SB_UPPER 0x0200
49 #define WL_CHANSPEC_CTL_SB_NONE 0x0300
50
51 #define WL_CHANSPEC_BW_MASK 0x0C00
52 #define WL_CHANSPEC_BW_SHIFT 10
53 #define WL_CHANSPEC_BW_10 0x0400
54 #define WL_CHANSPEC_BW_20 0x0800
55 #define WL_CHANSPEC_BW_40 0x0C00
56 #define WL_CHANSPEC_BW_80 0x2000
57
58 #define WL_CHANSPEC_BAND_MASK 0xf000
59 #define WL_CHANSPEC_BAND_SHIFT 12
60 #define WL_CHANSPEC_BAND_5G 0x1000
61 #define WL_CHANSPEC_BAND_2G 0x2000
62 #define INVCHANSPEC 255
63
64 #define WL_CHAN_VALID_HW (1 << 0)
65 #define WL_CHAN_VALID_SW (1 << 1)
66 #define WL_CHAN_BAND_5G (1 << 2)
67 #define WL_CHAN_RADAR (1 << 3)
68 #define WL_CHAN_INACTIVE (1 << 4)
69 #define WL_CHAN_PASSIVE (1 << 5)
70 #define WL_CHAN_RESTRICTED (1 << 6)
71
72
73 #define WLC_N_BW_20ALL 0
74 #define WLC_N_BW_40ALL 1
75 #define WLC_N_BW_20IN2G_40IN5G 2
76
77 #define WLC_BW_20MHZ_BIT BIT(0)
78 #define WLC_BW_40MHZ_BIT BIT(1)
79 #define WLC_BW_80MHZ_BIT BIT(2)
80 #define WLC_BW_160MHZ_BIT BIT(3)
81
82
83 #define WLC_BW_CAP_20MHZ (WLC_BW_20MHZ_BIT)
84 #define WLC_BW_CAP_40MHZ (WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
85 #define WLC_BW_CAP_80MHZ (WLC_BW_80MHZ_BIT|WLC_BW_40MHZ_BIT| \
86 WLC_BW_20MHZ_BIT)
87 #define WLC_BW_CAP_160MHZ (WLC_BW_160MHZ_BIT|WLC_BW_80MHZ_BIT| \
88 WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
89 #define WLC_BW_CAP_UNRESTRICTED 0xFF
90
91
92 #define WLC_BAND_AUTO 0
93 #define WLC_BAND_5G 1
94 #define WLC_BAND_2G 2
95 #define WLC_BAND_ALL 3
96
97 #define CHSPEC_CHANNEL(chspec) ((u8)((chspec) & WL_CHANSPEC_CHAN_MASK))
98 #define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK)
99
100 #define CHSPEC_CTL_SB(chspec) ((chspec) & WL_CHANSPEC_CTL_SB_MASK)
101 #define CHSPEC_BW(chspec) ((chspec) & WL_CHANSPEC_BW_MASK)
102
103 #define CHSPEC_IS10(chspec) \
104 (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10)
105
106 #define CHSPEC_IS20(chspec) \
107 (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20)
108
109 #define CHSPEC_IS40(chspec) \
110 (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40)
111
112 #define CHSPEC_IS80(chspec) \
113 (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_80)
114
115 #define CHSPEC_IS5G(chspec) \
116 (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G)
117
118 #define CHSPEC_IS2G(chspec) \
119 (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G)
120
121 #define CHSPEC_SB_NONE(chspec) \
122 (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE)
123
124 #define CHSPEC_SB_UPPER(chspec) \
125 (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER)
126
127 #define CHSPEC_SB_LOWER(chspec) \
128 (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER)
129
130 #define CHSPEC_CTL_CHAN(chspec) \
131 ((CHSPEC_SB_LOWER(chspec)) ? \
132 (lower_20_sb(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \
133 (upper_20_sb(((chspec) & WL_CHANSPEC_CHAN_MASK))))
134
135 #define CHSPEC2BAND(chspec) (CHSPEC_IS5G(chspec) ? BRCM_BAND_5G : BRCM_BAND_2G)
136
137 #define CHANSPEC_STR_LEN 8
138
139 static inline int lower_20_sb(int channel)
140 {
141 return channel > CH_10MHZ_APART ? (channel - CH_10MHZ_APART) : 0;
142 }
143
144 static inline int upper_20_sb(int channel)
145 {
146 return (channel < (MAXCHANNEL - CH_10MHZ_APART)) ?
147 channel + CH_10MHZ_APART : 0;
148 }
149
150 static inline int chspec_bandunit(u16 chspec)
151 {
152 return CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX;
153 }
154
155 static inline u16 ch20mhz_chspec(int channel)
156 {
157 u16 rc = channel <= CH_MAX_2G_CHANNEL ?
158 WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G;
159
160 return (u16)((u16)channel | WL_CHANSPEC_BW_20 |
161 WL_CHANSPEC_CTL_SB_NONE | rc);
162 }
163
164 static inline int next_20mhz_chan(int channel)
165 {
166 return channel < (MAXCHANNEL - CH_20MHZ_APART) ?
167 channel + CH_20MHZ_APART : 0;
168 }
169
170
171 #define BRCM_MAXRATE 108
172 #define BRCM_RATE_1M 2
173 #define BRCM_RATE_2M 4
174 #define BRCM_RATE_5M5 11
175 #define BRCM_RATE_11M 22
176 #define BRCM_RATE_6M 12
177 #define BRCM_RATE_9M 18
178 #define BRCM_RATE_12M 24
179 #define BRCM_RATE_18M 36
180 #define BRCM_RATE_24M 48
181 #define BRCM_RATE_36M 72
182 #define BRCM_RATE_48M 96
183 #define BRCM_RATE_54M 108
184
185 #define BRCM_2G_25MHZ_OFFSET 5
186
187 #define MCSSET_LEN 16
188
189 static inline bool ac_bitmap_tst(u8 bitmap, int prec)
190 {
191 return (bitmap & (1 << (prec))) != 0;
192 }
193
194
195 #define CRYPTO_ALGO_OFF 0
196 #define CRYPTO_ALGO_WEP1 1
197 #define CRYPTO_ALGO_TKIP 2
198 #define CRYPTO_ALGO_WEP128 3
199 #define CRYPTO_ALGO_AES_CCM 4
200 #define CRYPTO_ALGO_AES_RESERVED1 5
201 #define CRYPTO_ALGO_AES_RESERVED2 6
202 #define CRYPTO_ALGO_NALG 7
203
204
205
206 #define WEP_ENABLED 0x0001
207 #define TKIP_ENABLED 0x0002
208 #define AES_ENABLED 0x0004
209 #define WSEC_SWFLAG 0x0008
210
211 #define SES_OW_ENABLED 0x0040
212
213 #define MFP_CAPABLE 0x0200
214 #define MFP_REQUIRED 0x0400
215
216
217 #define WPA_AUTH_DISABLED 0x0000
218 #define WPA_AUTH_NONE 0x0001
219 #define WPA_AUTH_UNSPECIFIED 0x0002
220 #define WPA_AUTH_PSK 0x0004
221 #define WPA_AUTH_RESERVED1 0x0008
222 #define WPA_AUTH_RESERVED2 0x0010
223
224 #define WPA2_AUTH_RESERVED1 0x0020
225 #define WPA2_AUTH_UNSPECIFIED 0x0040
226 #define WPA2_AUTH_PSK 0x0080
227 #define WPA2_AUTH_RESERVED3 0x0200
228 #define WPA2_AUTH_RESERVED4 0x0400
229 #define WPA2_AUTH_RESERVED5 0x0800
230 #define WPA2_AUTH_1X_SHA256 0x1000
231 #define WPA2_AUTH_FT 0x4000
232 #define WPA2_AUTH_PSK_SHA256 0x8000
233
234 #define DOT11_DEFAULT_RTS_LEN 2347
235 #define DOT11_DEFAULT_FRAG_LEN 2346
236
237 #define DOT11_ICV_AES_LEN 8
238 #define DOT11_QOS_LEN 2
239 #define DOT11_IV_MAX_LEN 8
240 #define DOT11_A4_HDR_LEN 30
241
242 #define HT_CAP_RX_STBC_NO 0x0
243 #define HT_CAP_RX_STBC_ONE_STREAM 0x1
244
245 #endif