mac80211: update to wireless-testing 2012-02-23
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar9001_initvals.h
2 +++ b/drivers/net/wireless/ath/ath9k/ar9001_initvals.h
3 @@ -459,97 +459,6 @@ static const u32 ar5416Common_9100[][2]
4 {0x0000a3e0, 0x000001ce},
5 };
6
7 -static const u32 ar5416Bank0_9100[][2] = {
8 - /* Addr allmodes */
9 - {0x000098b0, 0x1e5795e5},
10 - {0x000098e0, 0x02008020},
11 -};
12 -
13 -static const u32 ar5416BB_RfGain_9100[][3] = {
14 - /* Addr 5G_HT20 5G_HT40 */
15 - {0x00009a00, 0x00000000, 0x00000000},
16 - {0x00009a04, 0x00000040, 0x00000040},
17 - {0x00009a08, 0x00000080, 0x00000080},
18 - {0x00009a0c, 0x000001a1, 0x00000141},
19 - {0x00009a10, 0x000001e1, 0x00000181},
20 - {0x00009a14, 0x00000021, 0x000001c1},
21 - {0x00009a18, 0x00000061, 0x00000001},
22 - {0x00009a1c, 0x00000168, 0x00000041},
23 - {0x00009a20, 0x000001a8, 0x000001a8},
24 - {0x00009a24, 0x000001e8, 0x000001e8},
25 - {0x00009a28, 0x00000028, 0x00000028},
26 - {0x00009a2c, 0x00000068, 0x00000068},
27 - {0x00009a30, 0x00000189, 0x000000a8},
28 - {0x00009a34, 0x000001c9, 0x00000169},
29 - {0x00009a38, 0x00000009, 0x000001a9},
30 - {0x00009a3c, 0x00000049, 0x000001e9},
31 - {0x00009a40, 0x00000089, 0x00000029},
32 - {0x00009a44, 0x00000170, 0x00000069},
33 - {0x00009a48, 0x000001b0, 0x00000190},
34 - {0x00009a4c, 0x000001f0, 0x000001d0},
35 - {0x00009a50, 0x00000030, 0x00000010},
36 - {0x00009a54, 0x00000070, 0x00000050},
37 - {0x00009a58, 0x00000191, 0x00000090},
38 - {0x00009a5c, 0x000001d1, 0x00000151},
39 - {0x00009a60, 0x00000011, 0x00000191},
40 - {0x00009a64, 0x00000051, 0x000001d1},
41 - {0x00009a68, 0x00000091, 0x00000011},
42 - {0x00009a6c, 0x000001b8, 0x00000051},
43 - {0x00009a70, 0x000001f8, 0x00000198},
44 - {0x00009a74, 0x00000038, 0x000001d8},
45 - {0x00009a78, 0x00000078, 0x00000018},
46 - {0x00009a7c, 0x00000199, 0x00000058},
47 - {0x00009a80, 0x000001d9, 0x00000098},
48 - {0x00009a84, 0x00000019, 0x00000159},
49 - {0x00009a88, 0x00000059, 0x00000199},
50 - {0x00009a8c, 0x00000099, 0x000001d9},
51 - {0x00009a90, 0x000000d9, 0x00000019},
52 - {0x00009a94, 0x000000f9, 0x00000059},
53 - {0x00009a98, 0x000000f9, 0x00000099},
54 - {0x00009a9c, 0x000000f9, 0x000000d9},
55 - {0x00009aa0, 0x000000f9, 0x000000f9},
56 - {0x00009aa4, 0x000000f9, 0x000000f9},
57 - {0x00009aa8, 0x000000f9, 0x000000f9},
58 - {0x00009aac, 0x000000f9, 0x000000f9},
59 - {0x00009ab0, 0x000000f9, 0x000000f9},
60 - {0x00009ab4, 0x000000f9, 0x000000f9},
61 - {0x00009ab8, 0x000000f9, 0x000000f9},
62 - {0x00009abc, 0x000000f9, 0x000000f9},
63 - {0x00009ac0, 0x000000f9, 0x000000f9},
64 - {0x00009ac4, 0x000000f9, 0x000000f9},
65 - {0x00009ac8, 0x000000f9, 0x000000f9},
66 - {0x00009acc, 0x000000f9, 0x000000f9},
67 - {0x00009ad0, 0x000000f9, 0x000000f9},
68 - {0x00009ad4, 0x000000f9, 0x000000f9},
69 - {0x00009ad8, 0x000000f9, 0x000000f9},
70 - {0x00009adc, 0x000000f9, 0x000000f9},
71 - {0x00009ae0, 0x000000f9, 0x000000f9},
72 - {0x00009ae4, 0x000000f9, 0x000000f9},
73 - {0x00009ae8, 0x000000f9, 0x000000f9},
74 - {0x00009aec, 0x000000f9, 0x000000f9},
75 - {0x00009af0, 0x000000f9, 0x000000f9},
76 - {0x00009af4, 0x000000f9, 0x000000f9},
77 - {0x00009af8, 0x000000f9, 0x000000f9},
78 - {0x00009afc, 0x000000f9, 0x000000f9},
79 -};
80 -
81 -static const u32 ar5416Bank1_9100[][2] = {
82 - /* Addr allmodes */
83 - {0x000098b0, 0x02108421},
84 - {0x000098ec, 0x00000008},
85 -};
86 -
87 -static const u32 ar5416Bank2_9100[][2] = {
88 - /* Addr allmodes */
89 - {0x000098b0, 0x0e73ff17},
90 - {0x000098e0, 0x00000420},
91 -};
92 -
93 -static const u32 ar5416Bank3_9100[][3] = {
94 - /* Addr 5G_HT20 5G_HT40 */
95 - {0x000098f0, 0x01400018, 0x01c00018},
96 -};
97 -
98 static const u32 ar5416Bank6_9100[][3] = {
99 /* Addr 5G_HT20 5G_HT40 */
100 {0x0000989c, 0x00000000, 0x00000000},
101 @@ -624,13 +533,6 @@ static const u32 ar5416Bank6TPC_9100[][3
102 {0x000098d0, 0x0000000f, 0x0010000f},
103 };
104
105 -static const u32 ar5416Bank7_9100[][2] = {
106 - /* Addr allmodes */
107 - {0x0000989c, 0x00000500},
108 - {0x0000989c, 0x00000800},
109 - {0x000098cc, 0x0000000e},
110 -};
111 -
112 static const u32 ar5416Addac_9100[][2] = {
113 /* Addr allmodes */
114 {0x0000989c, 0x00000000},
115 @@ -1113,178 +1015,6 @@ static const u32 ar5416Common_9160[][2]
116 {0x0000a3e0, 0x000001ce},
117 };
118
119 -static const u32 ar5416Bank0_9160[][2] = {
120 - /* Addr allmodes */
121 - {0x000098b0, 0x1e5795e5},
122 - {0x000098e0, 0x02008020},
123 -};
124 -
125 -static const u32 ar5416BB_RfGain_9160[][3] = {
126 - /* Addr 5G_HT20 5G_HT40 */
127 - {0x00009a00, 0x00000000, 0x00000000},
128 - {0x00009a04, 0x00000040, 0x00000040},
129 - {0x00009a08, 0x00000080, 0x00000080},
130 - {0x00009a0c, 0x000001a1, 0x00000141},
131 - {0x00009a10, 0x000001e1, 0x00000181},
132 - {0x00009a14, 0x00000021, 0x000001c1},
133 - {0x00009a18, 0x00000061, 0x00000001},
134 - {0x00009a1c, 0x00000168, 0x00000041},
135 - {0x00009a20, 0x000001a8, 0x000001a8},
136 - {0x00009a24, 0x000001e8, 0x000001e8},
137 - {0x00009a28, 0x00000028, 0x00000028},
138 - {0x00009a2c, 0x00000068, 0x00000068},
139 - {0x00009a30, 0x00000189, 0x000000a8},
140 - {0x00009a34, 0x000001c9, 0x00000169},
141 - {0x00009a38, 0x00000009, 0x000001a9},
142 - {0x00009a3c, 0x00000049, 0x000001e9},
143 - {0x00009a40, 0x00000089, 0x00000029},
144 - {0x00009a44, 0x00000170, 0x00000069},
145 - {0x00009a48, 0x000001b0, 0x00000190},
146 - {0x00009a4c, 0x000001f0, 0x000001d0},
147 - {0x00009a50, 0x00000030, 0x00000010},
148 - {0x00009a54, 0x00000070, 0x00000050},
149 - {0x00009a58, 0x00000191, 0x00000090},
150 - {0x00009a5c, 0x000001d1, 0x00000151},
151 - {0x00009a60, 0x00000011, 0x00000191},
152 - {0x00009a64, 0x00000051, 0x000001d1},
153 - {0x00009a68, 0x00000091, 0x00000011},
154 - {0x00009a6c, 0x000001b8, 0x00000051},
155 - {0x00009a70, 0x000001f8, 0x00000198},
156 - {0x00009a74, 0x00000038, 0x000001d8},
157 - {0x00009a78, 0x00000078, 0x00000018},
158 - {0x00009a7c, 0x00000199, 0x00000058},
159 - {0x00009a80, 0x000001d9, 0x00000098},
160 - {0x00009a84, 0x00000019, 0x00000159},
161 - {0x00009a88, 0x00000059, 0x00000199},
162 - {0x00009a8c, 0x00000099, 0x000001d9},
163 - {0x00009a90, 0x000000d9, 0x00000019},
164 - {0x00009a94, 0x000000f9, 0x00000059},
165 - {0x00009a98, 0x000000f9, 0x00000099},
166 - {0x00009a9c, 0x000000f9, 0x000000d9},
167 - {0x00009aa0, 0x000000f9, 0x000000f9},
168 - {0x00009aa4, 0x000000f9, 0x000000f9},
169 - {0x00009aa8, 0x000000f9, 0x000000f9},
170 - {0x00009aac, 0x000000f9, 0x000000f9},
171 - {0x00009ab0, 0x000000f9, 0x000000f9},
172 - {0x00009ab4, 0x000000f9, 0x000000f9},
173 - {0x00009ab8, 0x000000f9, 0x000000f9},
174 - {0x00009abc, 0x000000f9, 0x000000f9},
175 - {0x00009ac0, 0x000000f9, 0x000000f9},
176 - {0x00009ac4, 0x000000f9, 0x000000f9},
177 - {0x00009ac8, 0x000000f9, 0x000000f9},
178 - {0x00009acc, 0x000000f9, 0x000000f9},
179 - {0x00009ad0, 0x000000f9, 0x000000f9},
180 - {0x00009ad4, 0x000000f9, 0x000000f9},
181 - {0x00009ad8, 0x000000f9, 0x000000f9},
182 - {0x00009adc, 0x000000f9, 0x000000f9},
183 - {0x00009ae0, 0x000000f9, 0x000000f9},
184 - {0x00009ae4, 0x000000f9, 0x000000f9},
185 - {0x00009ae8, 0x000000f9, 0x000000f9},
186 - {0x00009aec, 0x000000f9, 0x000000f9},
187 - {0x00009af0, 0x000000f9, 0x000000f9},
188 - {0x00009af4, 0x000000f9, 0x000000f9},
189 - {0x00009af8, 0x000000f9, 0x000000f9},
190 - {0x00009afc, 0x000000f9, 0x000000f9},
191 -};
192 -
193 -static const u32 ar5416Bank1_9160[][2] = {
194 - /* Addr allmodes */
195 - {0x000098b0, 0x02108421},
196 - {0x000098ec, 0x00000008},
197 -};
198 -
199 -static const u32 ar5416Bank2_9160[][2] = {
200 - /* Addr allmodes */
201 - {0x000098b0, 0x0e73ff17},
202 - {0x000098e0, 0x00000420},
203 -};
204 -
205 -static const u32 ar5416Bank3_9160[][3] = {
206 - /* Addr 5G_HT20 5G_HT40 */
207 - {0x000098f0, 0x01400018, 0x01c00018},
208 -};
209 -
210 -static const u32 ar5416Bank6_9160[][3] = {
211 - /* Addr 5G_HT20 5G_HT40 */
212 - {0x0000989c, 0x00000000, 0x00000000},
213 - {0x0000989c, 0x00000000, 0x00000000},
214 - {0x0000989c, 0x00000000, 0x00000000},
215 - {0x0000989c, 0x00e00000, 0x00e00000},
216 - {0x0000989c, 0x005e0000, 0x005e0000},
217 - {0x0000989c, 0x00120000, 0x00120000},
218 - {0x0000989c, 0x00620000, 0x00620000},
219 - {0x0000989c, 0x00020000, 0x00020000},
220 - {0x0000989c, 0x00ff0000, 0x00ff0000},
221 - {0x0000989c, 0x00ff0000, 0x00ff0000},
222 - {0x0000989c, 0x00ff0000, 0x00ff0000},
223 - {0x0000989c, 0x40ff0000, 0x40ff0000},
224 - {0x0000989c, 0x005f0000, 0x005f0000},
225 - {0x0000989c, 0x00870000, 0x00870000},
226 - {0x0000989c, 0x00f90000, 0x00f90000},
227 - {0x0000989c, 0x007b0000, 0x007b0000},
228 - {0x0000989c, 0x00ff0000, 0x00ff0000},
229 - {0x0000989c, 0x00f50000, 0x00f50000},
230 - {0x0000989c, 0x00dc0000, 0x00dc0000},
231 - {0x0000989c, 0x00110000, 0x00110000},
232 - {0x0000989c, 0x006100a8, 0x006100a8},
233 - {0x0000989c, 0x004210a2, 0x004210a2},
234 - {0x0000989c, 0x0014008f, 0x0014008f},
235 - {0x0000989c, 0x00c40003, 0x00c40003},
236 - {0x0000989c, 0x003000f2, 0x003000f2},
237 - {0x0000989c, 0x00440016, 0x00440016},
238 - {0x0000989c, 0x00410040, 0x00410040},
239 - {0x0000989c, 0x0001805e, 0x0001805e},
240 - {0x0000989c, 0x0000c0ab, 0x0000c0ab},
241 - {0x0000989c, 0x000000f1, 0x000000f1},
242 - {0x0000989c, 0x00002081, 0x00002081},
243 - {0x0000989c, 0x000000d4, 0x000000d4},
244 - {0x000098d0, 0x0000000f, 0x0010000f},
245 -};
246 -
247 -static const u32 ar5416Bank6TPC_9160[][3] = {
248 - /* Addr 5G_HT20 5G_HT40 */
249 - {0x0000989c, 0x00000000, 0x00000000},
250 - {0x0000989c, 0x00000000, 0x00000000},
251 - {0x0000989c, 0x00000000, 0x00000000},
252 - {0x0000989c, 0x00e00000, 0x00e00000},
253 - {0x0000989c, 0x005e0000, 0x005e0000},
254 - {0x0000989c, 0x00120000, 0x00120000},
255 - {0x0000989c, 0x00620000, 0x00620000},
256 - {0x0000989c, 0x00020000, 0x00020000},
257 - {0x0000989c, 0x00ff0000, 0x00ff0000},
258 - {0x0000989c, 0x00ff0000, 0x00ff0000},
259 - {0x0000989c, 0x00ff0000, 0x00ff0000},
260 - {0x0000989c, 0x40ff0000, 0x40ff0000},
261 - {0x0000989c, 0x005f0000, 0x005f0000},
262 - {0x0000989c, 0x00870000, 0x00870000},
263 - {0x0000989c, 0x00f90000, 0x00f90000},
264 - {0x0000989c, 0x007b0000, 0x007b0000},
265 - {0x0000989c, 0x00ff0000, 0x00ff0000},
266 - {0x0000989c, 0x00f50000, 0x00f50000},
267 - {0x0000989c, 0x00dc0000, 0x00dc0000},
268 - {0x0000989c, 0x00110000, 0x00110000},
269 - {0x0000989c, 0x006100a8, 0x006100a8},
270 - {0x0000989c, 0x00423022, 0x00423022},
271 - {0x0000989c, 0x2014008f, 0x2014008f},
272 - {0x0000989c, 0x00c40002, 0x00c40002},
273 - {0x0000989c, 0x003000f2, 0x003000f2},
274 - {0x0000989c, 0x00440016, 0x00440016},
275 - {0x0000989c, 0x00410040, 0x00410040},
276 - {0x0000989c, 0x0001805e, 0x0001805e},
277 - {0x0000989c, 0x0000c0ab, 0x0000c0ab},
278 - {0x0000989c, 0x000000e1, 0x000000e1},
279 - {0x0000989c, 0x00007080, 0x00007080},
280 - {0x0000989c, 0x000000d4, 0x000000d4},
281 - {0x000098d0, 0x0000000f, 0x0010000f},
282 -};
283 -
284 -static const u32 ar5416Bank7_9160[][2] = {
285 - /* Addr allmodes */
286 - {0x0000989c, 0x00000500},
287 - {0x0000989c, 0x00000800},
288 - {0x000098cc, 0x0000000e},
289 -};
290 -
291 static const u32 ar5416Addac_9160[][2] = {
292 /* Addr allmodes */
293 {0x0000989c, 0x00000000},
294 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
295 +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
296 @@ -35,11 +35,11 @@ static void ar9002_hw_init_mode_regs(str
297 INIT_INI_ARRAY(&ah->iniCommon, ar9271Common_9271,
298 ARRAY_SIZE(ar9271Common_9271), 2);
299 INIT_INI_ARRAY(&ah->iniCommon_normal_cck_fir_coeff_9271,
300 - ar9271Common_normal_cck_fir_coeff_9271,
301 - ARRAY_SIZE(ar9271Common_normal_cck_fir_coeff_9271), 2);
302 + ar9287Common_normal_cck_fir_coeff_9287_1_1,
303 + ARRAY_SIZE(ar9287Common_normal_cck_fir_coeff_9287_1_1), 2);
304 INIT_INI_ARRAY(&ah->iniCommon_japan_2484_cck_fir_coeff_9271,
305 - ar9271Common_japan_2484_cck_fir_coeff_9271,
306 - ARRAY_SIZE(ar9271Common_japan_2484_cck_fir_coeff_9271), 2);
307 + ar9287Common_japan_2484_cck_fir_coeff_9287_1_1,
308 + ARRAY_SIZE(ar9287Common_japan_2484_cck_fir_coeff_9287_1_1), 2);
309 INIT_INI_ARRAY(&ah->iniModes_9271_1_0_only,
310 ar9271Modes_9271_1_0_only,
311 ARRAY_SIZE(ar9271Modes_9271_1_0_only), 5);
312 @@ -54,53 +54,31 @@ static void ar9002_hw_init_mode_regs(str
313 return;
314 }
315
316 + if (ah->config.pcie_clock_req)
317 + INIT_INI_ARRAY(&ah->iniPcieSerdes,
318 + ar9280PciePhy_clkreq_off_L1_9280,
319 + ARRAY_SIZE(ar9280PciePhy_clkreq_off_L1_9280), 2);
320 + else
321 + INIT_INI_ARRAY(&ah->iniPcieSerdes,
322 + ar9280PciePhy_clkreq_always_on_L1_9280,
323 + ARRAY_SIZE(ar9280PciePhy_clkreq_always_on_L1_9280), 2);
324 +
325 if (AR_SREV_9287_11_OR_LATER(ah)) {
326 INIT_INI_ARRAY(&ah->iniModes, ar9287Modes_9287_1_1,
327 ARRAY_SIZE(ar9287Modes_9287_1_1), 5);
328 INIT_INI_ARRAY(&ah->iniCommon, ar9287Common_9287_1_1,
329 ARRAY_SIZE(ar9287Common_9287_1_1), 2);
330 - if (ah->config.pcie_clock_req)
331 - INIT_INI_ARRAY(&ah->iniPcieSerdes,
332 - ar9287PciePhy_clkreq_off_L1_9287_1_1,
333 - ARRAY_SIZE(ar9287PciePhy_clkreq_off_L1_9287_1_1), 2);
334 - else
335 - INIT_INI_ARRAY(&ah->iniPcieSerdes,
336 - ar9287PciePhy_clkreq_always_on_L1_9287_1_1,
337 - ARRAY_SIZE(ar9287PciePhy_clkreq_always_on_L1_9287_1_1),
338 - 2);
339 } else if (AR_SREV_9285_12_OR_LATER(ah)) {
340 -
341 -
342 INIT_INI_ARRAY(&ah->iniModes, ar9285Modes_9285_1_2,
343 ARRAY_SIZE(ar9285Modes_9285_1_2), 5);
344 INIT_INI_ARRAY(&ah->iniCommon, ar9285Common_9285_1_2,
345 ARRAY_SIZE(ar9285Common_9285_1_2), 2);
346 -
347 - if (ah->config.pcie_clock_req) {
348 - INIT_INI_ARRAY(&ah->iniPcieSerdes,
349 - ar9285PciePhy_clkreq_off_L1_9285_1_2,
350 - ARRAY_SIZE(ar9285PciePhy_clkreq_off_L1_9285_1_2), 2);
351 - } else {
352 - INIT_INI_ARRAY(&ah->iniPcieSerdes,
353 - ar9285PciePhy_clkreq_always_on_L1_9285_1_2,
354 - ARRAY_SIZE(ar9285PciePhy_clkreq_always_on_L1_9285_1_2),
355 - 2);
356 - }
357 } else if (AR_SREV_9280_20_OR_LATER(ah)) {
358 INIT_INI_ARRAY(&ah->iniModes, ar9280Modes_9280_2,
359 ARRAY_SIZE(ar9280Modes_9280_2), 5);
360 INIT_INI_ARRAY(&ah->iniCommon, ar9280Common_9280_2,
361 ARRAY_SIZE(ar9280Common_9280_2), 2);
362
363 - if (ah->config.pcie_clock_req) {
364 - INIT_INI_ARRAY(&ah->iniPcieSerdes,
365 - ar9280PciePhy_clkreq_off_L1_9280,
366 - ARRAY_SIZE(ar9280PciePhy_clkreq_off_L1_9280), 2);
367 - } else {
368 - INIT_INI_ARRAY(&ah->iniPcieSerdes,
369 - ar9280PciePhy_clkreq_always_on_L1_9280,
370 - ARRAY_SIZE(ar9280PciePhy_clkreq_always_on_L1_9280), 2);
371 - }
372 INIT_INI_ARRAY(&ah->iniModesAdditional,
373 ar9280Modes_fast_clock_9280_2,
374 ARRAY_SIZE(ar9280Modes_fast_clock_9280_2), 3);
375 @@ -109,22 +87,6 @@ static void ar9002_hw_init_mode_regs(str
376 ARRAY_SIZE(ar5416Modes_9160), 5);
377 INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9160,
378 ARRAY_SIZE(ar5416Common_9160), 2);
379 - INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0_9160,
380 - ARRAY_SIZE(ar5416Bank0_9160), 2);
381 - INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain_9160,
382 - ARRAY_SIZE(ar5416BB_RfGain_9160), 3);
383 - INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1_9160,
384 - ARRAY_SIZE(ar5416Bank1_9160), 2);
385 - INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2_9160,
386 - ARRAY_SIZE(ar5416Bank2_9160), 2);
387 - INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3_9160,
388 - ARRAY_SIZE(ar5416Bank3_9160), 3);
389 - INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6_9160,
390 - ARRAY_SIZE(ar5416Bank6_9160), 3);
391 - INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9160,
392 - ARRAY_SIZE(ar5416Bank6TPC_9160), 3);
393 - INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7_9160,
394 - ARRAY_SIZE(ar5416Bank7_9160), 2);
395 if (AR_SREV_9160_11(ah)) {
396 INIT_INI_ARRAY(&ah->iniAddac,
397 ar5416Addac_9160_1_1,
398 @@ -138,22 +100,8 @@ static void ar9002_hw_init_mode_regs(str
399 ARRAY_SIZE(ar5416Modes_9100), 5);
400 INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9100,
401 ARRAY_SIZE(ar5416Common_9100), 2);
402 - INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0_9100,
403 - ARRAY_SIZE(ar5416Bank0_9100), 2);
404 - INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain_9100,
405 - ARRAY_SIZE(ar5416BB_RfGain_9100), 3);
406 - INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1_9100,
407 - ARRAY_SIZE(ar5416Bank1_9100), 2);
408 - INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2_9100,
409 - ARRAY_SIZE(ar5416Bank2_9100), 2);
410 - INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3_9100,
411 - ARRAY_SIZE(ar5416Bank3_9100), 3);
412 INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6_9100,
413 ARRAY_SIZE(ar5416Bank6_9100), 3);
414 - INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9100,
415 - ARRAY_SIZE(ar5416Bank6TPC_9100), 3);
416 - INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7_9100,
417 - ARRAY_SIZE(ar5416Bank7_9100), 2);
418 INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9100,
419 ARRAY_SIZE(ar5416Addac_9100), 2);
420 } else {
421 @@ -161,24 +109,37 @@ static void ar9002_hw_init_mode_regs(str
422 ARRAY_SIZE(ar5416Modes), 5);
423 INIT_INI_ARRAY(&ah->iniCommon, ar5416Common,
424 ARRAY_SIZE(ar5416Common), 2);
425 - INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0,
426 - ARRAY_SIZE(ar5416Bank0), 2);
427 + INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC,
428 + ARRAY_SIZE(ar5416Bank6TPC), 3);
429 + INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
430 + ARRAY_SIZE(ar5416Addac), 2);
431 + }
432 +
433 + if (!AR_SREV_9280_20_OR_LATER(ah)) {
434 + /* Common for AR5416, AR913x, AR9160 */
435 INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain,
436 ARRAY_SIZE(ar5416BB_RfGain), 3);
437 +
438 + INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0,
439 + ARRAY_SIZE(ar5416Bank0), 2);
440 INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1,
441 ARRAY_SIZE(ar5416Bank1), 2);
442 INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2,
443 ARRAY_SIZE(ar5416Bank2), 2);
444 INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3,
445 ARRAY_SIZE(ar5416Bank3), 3);
446 - INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6,
447 - ARRAY_SIZE(ar5416Bank6), 3);
448 - INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC,
449 - ARRAY_SIZE(ar5416Bank6TPC), 3);
450 INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7,
451 ARRAY_SIZE(ar5416Bank7), 2);
452 - INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
453 - ARRAY_SIZE(ar5416Addac), 2);
454 +
455 + /* Common for AR5416, AR9160 */
456 + if (!AR_SREV_9100(ah))
457 + INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6,
458 + ARRAY_SIZE(ar5416Bank6), 3);
459 +
460 + /* Common for AR913x, AR9160 */
461 + if (!AR_SREV_5416(ah))
462 + INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9100,
463 + ARRAY_SIZE(ar5416Bank6TPC_9100), 3);
464 }
465
466 /* iniAddac needs to be modified for these chips */
467 --- a/drivers/net/wireless/ath/ath9k/ar9002_initvals.h
468 +++ b/drivers/net/wireless/ath/ath9k/ar9002_initvals.h
469 @@ -925,34 +925,6 @@ static const u32 ar9280PciePhy_clkreq_al
470 {0x00004044, 0x00000000},
471 };
472
473 -static const u32 ar9285PciePhy_clkreq_always_on_L1_9285[][2] = {
474 - /* Addr allmodes */
475 - {0x00004040, 0x9248fd00},
476 - {0x00004040, 0x24924924},
477 - {0x00004040, 0xa8000019},
478 - {0x00004040, 0x13160820},
479 - {0x00004040, 0xe5980560},
480 - {0x00004040, 0xc01dcffd},
481 - {0x00004040, 0x1aaabe41},
482 - {0x00004040, 0xbe105554},
483 - {0x00004040, 0x00043007},
484 - {0x00004044, 0x00000000},
485 -};
486 -
487 -static const u32 ar9285PciePhy_clkreq_off_L1_9285[][2] = {
488 - /* Addr allmodes */
489 - {0x00004040, 0x9248fd00},
490 - {0x00004040, 0x24924924},
491 - {0x00004040, 0xa8000019},
492 - {0x00004040, 0x13160820},
493 - {0x00004040, 0xe5980560},
494 - {0x00004040, 0xc01dcffc},
495 - {0x00004040, 0x1aaabe41},
496 - {0x00004040, 0xbe105554},
497 - {0x00004040, 0x00043007},
498 - {0x00004044, 0x00000000},
499 -};
500 -
501 static const u32 ar9285Modes_9285_1_2[][5] = {
502 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
503 {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
504 @@ -1743,34 +1715,6 @@ static const u32 ar9285Modes_XE2_0_high_
505 {0x0000a3e0, 0x000000e7, 0x000000e7, 0x000000e7, 0x000000e7},
506 };
507
508 -static const u32 ar9285PciePhy_clkreq_always_on_L1_9285_1_2[][2] = {
509 - /* Addr allmodes */
510 - {0x00004040, 0x9248fd00},
511 - {0x00004040, 0x24924924},
512 - {0x00004040, 0xa8000019},
513 - {0x00004040, 0x13160820},
514 - {0x00004040, 0xe5980560},
515 - {0x00004040, 0xc01dcffd},
516 - {0x00004040, 0x1aaabe41},
517 - {0x00004040, 0xbe105554},
518 - {0x00004040, 0x00043007},
519 - {0x00004044, 0x00000000},
520 -};
521 -
522 -static const u32 ar9285PciePhy_clkreq_off_L1_9285_1_2[][2] = {
523 - /* Addr allmodes */
524 - {0x00004040, 0x9248fd00},
525 - {0x00004040, 0x24924924},
526 - {0x00004040, 0xa8000019},
527 - {0x00004040, 0x13160820},
528 - {0x00004040, 0xe5980560},
529 - {0x00004040, 0xc01dcffc},
530 - {0x00004040, 0x1aaabe41},
531 - {0x00004040, 0xbe105554},
532 - {0x00004040, 0x00043007},
533 - {0x00004044, 0x00000000},
534 -};
535 -
536 static const u32 ar9287Modes_9287_1_1[][5] = {
537 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
538 {0x00001030, 0x00000000, 0x00000000, 0x000002c0, 0x00000160},
539 @@ -2512,34 +2456,6 @@ static const u32 ar9287Modes_rx_gain_928
540 {0x0000a848, 0x00000000, 0x00000000, 0x00001067, 0x00001067},
541 };
542
543 -static const u32 ar9287PciePhy_clkreq_always_on_L1_9287_1_1[][2] = {
544 - /* Addr allmodes */
545 - {0x00004040, 0x9248fd00},
546 - {0x00004040, 0x24924924},
547 - {0x00004040, 0xa8000019},
548 - {0x00004040, 0x13160820},
549 - {0x00004040, 0xe5980560},
550 - {0x00004040, 0xc01dcffd},
551 - {0x00004040, 0x1aaabe41},
552 - {0x00004040, 0xbe105554},
553 - {0x00004040, 0x00043007},
554 - {0x00004044, 0x00000000},
555 -};
556 -
557 -static const u32 ar9287PciePhy_clkreq_off_L1_9287_1_1[][2] = {
558 - /* Addr allmodes */
559 - {0x00004040, 0x9248fd00},
560 - {0x00004040, 0x24924924},
561 - {0x00004040, 0xa8000019},
562 - {0x00004040, 0x13160820},
563 - {0x00004040, 0xe5980560},
564 - {0x00004040, 0xc01dcffc},
565 - {0x00004040, 0x1aaabe41},
566 - {0x00004040, 0xbe105554},
567 - {0x00004040, 0x00043007},
568 - {0x00004044, 0x00000000},
569 -};
570 -
571 static const u32 ar9271Modes_9271[][5] = {
572 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
573 {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
574 @@ -3176,20 +3092,6 @@ static const u32 ar9271Common_9271[][2]
575 {0x0000d384, 0xf3307ff0},
576 };
577
578 -static const u32 ar9271Common_normal_cck_fir_coeff_9271[][2] = {
579 - /* Addr allmodes */
580 - {0x0000a1f4, 0x00fffeff},
581 - {0x0000a1f8, 0x00f5f9ff},
582 - {0x0000a1fc, 0xb79f6427},
583 -};
584 -
585 -static const u32 ar9271Common_japan_2484_cck_fir_coeff_9271[][2] = {
586 - /* Addr allmodes */
587 - {0x0000a1f4, 0x00000000},
588 - {0x0000a1f8, 0xefff0301},
589 - {0x0000a1fc, 0xca9228ee},
590 -};
591 -
592 static const u32 ar9271Modes_9271_1_0_only[][5] = {
593 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
594 {0x00009910, 0x30002311, 0x30002311, 0x30002311, 0x30002311},
595 --- a/net/mac80211/agg-rx.c
596 +++ b/net/mac80211/agg-rx.c
597 @@ -187,6 +187,8 @@ static void ieee80211_send_addba_resp(st
598 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
599 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
600 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
601 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
602 + memcpy(mgmt->bssid, da, ETH_ALEN);
603
604 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
605 IEEE80211_STYPE_ACTION);
606 --- a/net/mac80211/agg-tx.c
607 +++ b/net/mac80211/agg-tx.c
608 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
609 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
610 if (sdata->vif.type == NL80211_IFTYPE_AP ||
611 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
612 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
613 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
614 + sdata->vif.type == NL80211_IFTYPE_WDS)
615 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
616 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
617 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
618 @@ -471,6 +472,7 @@ int ieee80211_start_tx_ba_session(struct
619 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
620 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
621 sdata->vif.type != NL80211_IFTYPE_AP &&
622 + sdata->vif.type != NL80211_IFTYPE_WDS &&
623 sdata->vif.type != NL80211_IFTYPE_ADHOC)
624 return -EINVAL;
625
626 --- a/net/mac80211/debugfs_sta.c
627 +++ b/net/mac80211/debugfs_sta.c
628 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
629 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
630
631 int res = scnprintf(buf, sizeof(buf),
632 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
633 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
634 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
635 TEST(PS_DRIVER), TEST(AUTHORIZED),
636 TEST(SHORT_PREAMBLE),
637 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
638 + TEST(WME), TEST(CLEAR_PS_FILT),
639 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
640 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
641 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
642 --- a/net/mac80211/iface.c
643 +++ b/net/mac80211/iface.c
644 @@ -178,7 +178,6 @@ static int ieee80211_do_open(struct net_
645 {
646 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
647 struct ieee80211_local *local = sdata->local;
648 - struct sta_info *sta;
649 u32 changed = 0;
650 int res;
651 u32 hw_reconf_flags = 0;
652 @@ -309,28 +308,6 @@ static int ieee80211_do_open(struct net_
653
654 set_bit(SDATA_STATE_RUNNING, &sdata->state);
655
656 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
657 - /* Create STA entry for the WDS peer */
658 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
659 - GFP_KERNEL);
660 - if (!sta) {
661 - res = -ENOMEM;
662 - goto err_del_interface;
663 - }
664 -
665 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
666 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
667 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
668 -
669 - res = sta_info_insert(sta);
670 - if (res) {
671 - /* STA has been freed */
672 - goto err_del_interface;
673 - }
674 -
675 - rate_control_rate_init(sta);
676 - }
677 -
678 /*
679 * set_multicast_list will be invoked by the networking core
680 * which will check whether any increments here were done in
681 @@ -357,8 +334,7 @@ static int ieee80211_do_open(struct net_
682 netif_tx_start_all_queues(dev);
683
684 return 0;
685 - err_del_interface:
686 - drv_remove_interface(local, sdata);
687 +
688 err_stop:
689 if (!local->open_count)
690 drv_stop(local);
691 @@ -654,6 +630,8 @@ static void ieee80211_teardown_sdata(str
692
693 if (ieee80211_vif_is_mesh(&sdata->vif))
694 mesh_rmc_free(sdata);
695 + else if (sdata->vif.type == NL80211_IFTYPE_STATION)
696 + ieee80211_mgd_teardown(sdata);
697
698 flushed = sta_info_flush(local, sdata);
699 WARN_ON(flushed);
700 @@ -720,6 +698,70 @@ static void ieee80211_if_setup(struct ne
701 dev->destructor = free_netdev;
702 }
703
704 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
705 + struct sk_buff *skb)
706 +{
707 + struct ieee80211_local *local = sdata->local;
708 + struct ieee80211_rx_status *rx_status;
709 + struct ieee802_11_elems elems;
710 + struct ieee80211_mgmt *mgmt;
711 + struct sta_info *sta;
712 + size_t baselen;
713 + u32 rates = 0;
714 + u16 stype;
715 + bool new = false;
716 + enum ieee80211_band band = local->hw.conf.channel->band;
717 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
718 +
719 + rx_status = IEEE80211_SKB_RXCB(skb);
720 + mgmt = (struct ieee80211_mgmt *) skb->data;
721 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
722 +
723 + if (stype != IEEE80211_STYPE_BEACON)
724 + return;
725 +
726 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
727 + if (baselen > skb->len)
728 + return;
729 +
730 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
731 + skb->len - baselen, &elems);
732 +
733 + rates = ieee80211_sta_get_rates(local, &elems, band);
734 +
735 + rcu_read_lock();
736 +
737 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
738 +
739 + if (!sta) {
740 + rcu_read_unlock();
741 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
742 + GFP_KERNEL);
743 + if (!sta)
744 + return;
745 +
746 + new = true;
747 + }
748 +
749 + sta->last_rx = jiffies;
750 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
751 +
752 + if (elems.ht_cap_elem)
753 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
754 + elems.ht_cap_elem, &sta->sta.ht_cap);
755 +
756 + if (elems.wmm_param)
757 + set_sta_flag(sta, WLAN_STA_WME);
758 +
759 + if (new) {
760 + set_sta_flag(sta, WLAN_STA_AUTHORIZED);
761 + rate_control_rate_init(sta);
762 + sta_info_insert_rcu(sta);
763 + }
764 +
765 + rcu_read_unlock();
766 +}
767 +
768 static void ieee80211_iface_work(struct work_struct *work)
769 {
770 struct ieee80211_sub_if_data *sdata =
771 @@ -824,6 +866,9 @@ static void ieee80211_iface_work(struct
772 break;
773 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
774 break;
775 + case NL80211_IFTYPE_WDS:
776 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
777 + break;
778 default:
779 WARN(1, "frame for unexpected interface type");
780 break;
781 --- a/net/mac80211/rx.c
782 +++ b/net/mac80211/rx.c
783 @@ -2281,6 +2281,7 @@ ieee80211_rx_h_action(struct ieee80211_r
784 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
785 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
786 sdata->vif.type != NL80211_IFTYPE_AP &&
787 + sdata->vif.type != NL80211_IFTYPE_WDS &&
788 sdata->vif.type != NL80211_IFTYPE_ADHOC)
789 break;
790
791 @@ -2491,14 +2492,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
792
793 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
794 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
795 - sdata->vif.type != NL80211_IFTYPE_STATION)
796 + sdata->vif.type != NL80211_IFTYPE_STATION &&
797 + sdata->vif.type != NL80211_IFTYPE_WDS)
798 return RX_DROP_MONITOR;
799
800 switch (stype) {
801 case cpu_to_le16(IEEE80211_STYPE_AUTH):
802 case cpu_to_le16(IEEE80211_STYPE_BEACON):
803 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
804 - /* process for all: mesh, mlme, ibss */
805 + /* process for all: mesh, mlme, ibss, wds */
806 break;
807 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
808 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
809 @@ -2852,10 +2854,16 @@ static int prepare_for_handlers(struct i
810 }
811 break;
812 case NL80211_IFTYPE_WDS:
813 - if (bssid || !ieee80211_is_data(hdr->frame_control))
814 - return 0;
815 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
816 return 0;
817 +
818 + if (ieee80211_is_data(hdr->frame_control) ||
819 + ieee80211_is_action(hdr->frame_control)) {
820 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
821 + return 0;
822 + } else if (!ieee80211_is_beacon(hdr->frame_control))
823 + return 0;
824 +
825 break;
826 default:
827 /* should never get here */
828 --- a/net/mac80211/sta_info.h
829 +++ b/net/mac80211/sta_info.h
830 @@ -31,7 +31,6 @@
831 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
832 * frames.
833 * @WLAN_STA_WME: Station is a QoS-STA.
834 - * @WLAN_STA_WDS: Station is one of our WDS peers.
835 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
836 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
837 * frame to this station is transmitted.
838 @@ -62,7 +61,6 @@ enum ieee80211_sta_info_flags {
839 WLAN_STA_AUTHORIZED,
840 WLAN_STA_SHORT_PREAMBLE,
841 WLAN_STA_WME,
842 - WLAN_STA_WDS,
843 WLAN_STA_CLEAR_PS_FILT,
844 WLAN_STA_MFP,
845 WLAN_STA_BLOCK_BA,
846 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
847 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
848 @@ -530,7 +530,11 @@ int ath9k_hw_process_rxdesc_edma(struct
849 */
850 if (rxsp->status11 & AR_CRCErr)
851 rxs->rs_status |= ATH9K_RXERR_CRC;
852 - else if (rxsp->status11 & AR_PHYErr) {
853 + else if (rxsp->status11 & AR_DecryptCRCErr)
854 + rxs->rs_status |= ATH9K_RXERR_DECRYPT;
855 + else if (rxsp->status11 & AR_MichaelErr)
856 + rxs->rs_status |= ATH9K_RXERR_MIC;
857 + if (rxsp->status11 & AR_PHYErr) {
858 phyerr = MS(rxsp->status11, AR_PHYErrCode);
859 /*
860 * If we reach a point here where AR_PostDelimCRCErr is
861 @@ -552,11 +556,7 @@ int ath9k_hw_process_rxdesc_edma(struct
862 rxs->rs_status |= ATH9K_RXERR_PHY;
863 rxs->rs_phyerr = phyerr;
864 }
865 -
866 - } else if (rxsp->status11 & AR_DecryptCRCErr)
867 - rxs->rs_status |= ATH9K_RXERR_DECRYPT;
868 - else if (rxsp->status11 & AR_MichaelErr)
869 - rxs->rs_status |= ATH9K_RXERR_MIC;
870 + };
871 }
872
873 if (rxsp->status11 & AR_KeyMiss)
874 --- a/drivers/net/wireless/ath/carl9170/tx.c
875 +++ b/drivers/net/wireless/ath/carl9170/tx.c
876 @@ -1236,6 +1236,7 @@ static bool carl9170_tx_ps_drop(struct a
877 {
878 struct ieee80211_sta *sta;
879 struct carl9170_sta_info *sta_info;
880 + struct ieee80211_tx_info *tx_info;
881
882 rcu_read_lock();
883 sta = __carl9170_get_tx_sta(ar, skb);
884 @@ -1243,12 +1244,13 @@ static bool carl9170_tx_ps_drop(struct a
885 goto out_rcu;
886
887 sta_info = (void *) sta->drv_priv;
888 - if (unlikely(sta_info->sleeping)) {
889 - struct ieee80211_tx_info *tx_info;
890 + tx_info = IEEE80211_SKB_CB(skb);
891
892 + if (unlikely(sta_info->sleeping) &&
893 + !(tx_info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
894 + IEEE80211_TX_CTL_CLEAR_PS_FILT))) {
895 rcu_read_unlock();
896
897 - tx_info = IEEE80211_SKB_CB(skb);
898 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
899 atomic_dec(&ar->tx_ampdu_upload);
900
901 --- a/drivers/net/wireless/iwlegacy/4965-mac.c
902 +++ b/drivers/net/wireless/iwlegacy/4965-mac.c
903 @@ -1694,7 +1694,7 @@ il4965_tx_skb(struct il_priv *il, struct
904 sta_priv = (void *)sta->drv_priv;
905
906 if (sta_priv && sta_priv->asleep &&
907 - (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
908 + (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
909 /*
910 * This sends an asynchronous command to the device,
911 * but we can rely on it being processed before the
912 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
913 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
914 @@ -322,7 +322,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
915 sta_priv = (void *)info->control.sta->drv_priv;
916
917 if (sta_priv && sta_priv->asleep &&
918 - (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
919 + (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
920 /*
921 * This sends an asynchronous command to the device,
922 * but we can rely on it being processed before the
923 @@ -331,6 +331,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
924 * counter.
925 * For now set the counter to just 1 since we do not
926 * support uAPSD yet.
927 + *
928 + * FIXME: If we get two non-bufferable frames one
929 + * after the other, we might only send out one of
930 + * them because this is racy.
931 */
932 iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
933 }
934 --- a/drivers/net/wireless/p54/txrx.c
935 +++ b/drivers/net/wireless/p54/txrx.c
936 @@ -690,7 +690,7 @@ static void p54_tx_80211_header(struct p
937 if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
938 *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR;
939
940 - if (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)
941 + if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)
942 *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL;
943
944 if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
945 --- a/include/net/mac80211.h
946 +++ b/include/net/mac80211.h
947 @@ -341,9 +341,9 @@ struct ieee80211_bss_conf {
948 * used to indicate that a frame was already retried due to PS
949 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
950 * used to indicate frame should not be encrypted
951 - * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll
952 - * frame (PS-Poll or uAPSD) and should be sent although the station
953 - * is in powersave mode.
954 + * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
955 + * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
956 + * be sent although the station is in powersave mode.
957 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
958 * transmit function after the current frame, this can be used
959 * by drivers to kick the DMA queue only if unset or when the
960 @@ -399,7 +399,7 @@ enum mac80211_tx_control_flags {
961 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
962 IEEE80211_TX_INTFL_RETRIED = BIT(15),
963 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
964 - IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17),
965 + IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
966 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
967 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
968 /* hole at 20, use later */
969 @@ -425,7 +425,7 @@ enum mac80211_tx_control_flags {
970 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
971 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
972 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
973 - IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \
974 + IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
975 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
976 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
977
978 @@ -1634,7 +1634,7 @@ void ieee80211_free_txskb(struct ieee802
979 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
980 * will inform the driver of this with the @allow_buffered_frames
981 * callback; this callback is optional. mac80211 will then transmit
982 - * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE
983 + * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
984 * on each frame. The last frame in the service period (or the only
985 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
986 * indicate that it ends the service period; as this frame must have
987 @@ -1642,6 +1642,9 @@ void ieee80211_free_txskb(struct ieee802
988 * When TX status is reported for this frame, the service period is
989 * marked has having ended and a new one can be started by the peer.
990 *
991 + * Additionally, non-bufferable MMPDUs can also be transmitted by
992 + * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
993 + *
994 * Another race condition can happen on some devices like iwlwifi
995 * when there are frames queued for the station and it wakes up
996 * or polls; the frames that are already queued could end up being
997 @@ -2140,7 +2143,7 @@ enum ieee80211_frame_release_type {
998 * @allow_buffered_frames: Prepare device to allow the given number of frames
999 * to go out to the given station. The frames will be sent by mac80211
1000 * via the usual TX path after this call. The TX information for frames
1001 - * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set
1002 + * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
1003 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
1004 * frames from multiple TIDs are released and the driver might reorder
1005 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
1006 --- a/net/mac80211/ieee80211_i.h
1007 +++ b/net/mac80211/ieee80211_i.h
1008 @@ -1183,6 +1183,7 @@ void ieee80211_sta_rx_queued_mgmt(struct
1009 struct sk_buff *skb);
1010 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1011 void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
1012 +void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata);
1013
1014 /* IBSS code */
1015 void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
1016 --- a/net/mac80211/mlme.c
1017 +++ b/net/mac80211/mlme.c
1018 @@ -3496,6 +3496,19 @@ int ieee80211_mgd_disassoc(struct ieee80
1019 return 0;
1020 }
1021
1022 +void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata)
1023 +{
1024 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
1025 +
1026 + mutex_lock(&ifmgd->mtx);
1027 + if (ifmgd->assoc_data)
1028 + ieee80211_destroy_assoc_data(sdata, false);
1029 + if (ifmgd->auth_data)
1030 + ieee80211_destroy_auth_data(sdata, false);
1031 + del_timer_sync(&ifmgd->timer);
1032 + mutex_unlock(&ifmgd->mtx);
1033 +}
1034 +
1035 void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
1036 enum nl80211_cqm_rssi_threshold_event rssi_event,
1037 gfp_t gfp)
1038 --- a/net/mac80211/sta_info.c
1039 +++ b/net/mac80211/sta_info.c
1040 @@ -865,8 +865,10 @@ int sta_info_flush(struct ieee80211_loca
1041
1042 mutex_lock(&local->sta_mtx);
1043 list_for_each_entry_safe(sta, tmp, &local->sta_list, list) {
1044 - if (!sdata || sdata == sta->sdata)
1045 + if (!sdata || sdata == sta->sdata) {
1046 WARN_ON(__sta_info_destroy(sta));
1047 + ret++;
1048 + }
1049 }
1050 mutex_unlock(&local->sta_mtx);
1051
1052 @@ -1048,7 +1050,7 @@ static void ieee80211_send_null_response
1053 * exchange. Also set EOSP to indicate this packet
1054 * ends the poll/service period.
1055 */
1056 - info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE |
1057 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER |
1058 IEEE80211_TX_STATUS_EOSP |
1059 IEEE80211_TX_CTL_REQ_TX_STATUS;
1060
1061 @@ -1175,7 +1177,7 @@ ieee80211_sta_ps_deliver_response(struct
1062 * STA may still remain is PS mode after this frame
1063 * exchange.
1064 */
1065 - info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE;
1066 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
1067
1068 /*
1069 * Use MoreData flag to indicate whether there are
1070 --- a/net/mac80211/tx.c
1071 +++ b/net/mac80211/tx.c
1072 @@ -448,18 +448,23 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
1073 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
1074 struct ieee80211_local *local = tx->local;
1075
1076 - if (unlikely(!sta ||
1077 - ieee80211_is_probe_resp(hdr->frame_control) ||
1078 - ieee80211_is_auth(hdr->frame_control) ||
1079 - ieee80211_is_assoc_resp(hdr->frame_control) ||
1080 - ieee80211_is_reassoc_resp(hdr->frame_control)))
1081 + if (unlikely(!sta))
1082 return TX_CONTINUE;
1083
1084 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
1085 test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
1086 - !(info->flags & IEEE80211_TX_CTL_POLL_RESPONSE))) {
1087 + !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
1088 int ac = skb_get_queue_mapping(tx->skb);
1089
1090 + /* only deauth, disassoc and action are bufferable MMPDUs */
1091 + if (ieee80211_is_mgmt(hdr->frame_control) &&
1092 + !ieee80211_is_deauth(hdr->frame_control) &&
1093 + !ieee80211_is_disassoc(hdr->frame_control) &&
1094 + !ieee80211_is_action(hdr->frame_control)) {
1095 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
1096 + return TX_CONTINUE;
1097 + }
1098 +
1099 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
1100 printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n",
1101 sta->sta.addr, sta->sta.aid, ac);