fab677f2f93b930863bb396b16adf15d822d5437
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath5k/base.c
2 +++ b/drivers/net/wireless/ath/ath5k/base.c
3 @@ -2416,6 +2416,22 @@ ath5k_tx_complete_poll_work(struct work_
4 * Initialization routines *
5 \*************************/
6
7 +static const struct ieee80211_iface_limit if_limits[] = {
8 + { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) },
9 + { .max = 4, .types =
10 +#ifdef CONFIG_MAC80211_MESH
11 + BIT(NL80211_IFTYPE_MESH_POINT) |
12 +#endif
13 + BIT(NL80211_IFTYPE_AP) },
14 +};
15 +
16 +static const struct ieee80211_iface_combination if_comb = {
17 + .limits = if_limits,
18 + .n_limits = ARRAY_SIZE(if_limits),
19 + .max_interfaces = 2048,
20 + .num_different_channels = 1,
21 +};
22 +
23 int __devinit
24 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
25 {
26 @@ -2437,6 +2453,9 @@ ath5k_init_ah(struct ath5k_hw *ah, const
27 BIT(NL80211_IFTYPE_ADHOC) |
28 BIT(NL80211_IFTYPE_MESH_POINT);
29
30 + hw->wiphy->iface_combinations = &if_comb;
31 + hw->wiphy->n_iface_combinations = 1;
32 +
33 /* SW support for IBSS_RSN is provided by mac80211 */
34 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
35
36 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
37 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
38 @@ -618,19 +618,10 @@ static void ar5008_hw_init_bb(struct ath
39 u32 synthDelay;
40
41 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
42 - if (IS_CHAN_B(chan))
43 - synthDelay = (4 * synthDelay) / 22;
44 - else
45 - synthDelay /= 10;
46 -
47 - if (IS_CHAN_HALF_RATE(chan))
48 - synthDelay *= 2;
49 - else if (IS_CHAN_QUARTER_RATE(chan))
50 - synthDelay *= 4;
51
52 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
53
54 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
55 + ath9k_hw_synth_delay(ah, chan, synthDelay);
56 }
57
58 static void ar5008_hw_init_chain_masks(struct ath_hw *ah)
59 @@ -868,7 +859,7 @@ static int ar5008_hw_process_ini(struct
60 ar5008_hw_set_channel_regs(ah, chan);
61 ar5008_hw_init_chain_masks(ah);
62 ath9k_olc_init(ah);
63 - ath9k_hw_apply_txpower(ah, chan);
64 + ath9k_hw_apply_txpower(ah, chan, false);
65
66 /* Write analog registers */
67 if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) {
68 @@ -948,12 +939,8 @@ static bool ar5008_hw_rfbus_req(struct a
69 static void ar5008_hw_rfbus_done(struct ath_hw *ah)
70 {
71 u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
72 - if (IS_CHAN_B(ah->curchan))
73 - synthDelay = (4 * synthDelay) / 22;
74 - else
75 - synthDelay /= 10;
76
77 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
78 + ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
79
80 REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
81 }
82 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
83 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
84 @@ -1000,10 +1000,12 @@ static bool ar9003_hw_init_cal(struct at
85 if (mci && IS_CHAN_2GHZ(chan) && run_agc_cal)
86 ar9003_mci_init_cal_req(ah, &is_reusable);
87
88 - txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
89 - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
90 - udelay(5);
91 - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
92 + if (!(IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan))) {
93 + txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
94 + REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
95 + udelay(5);
96 + REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
97 + }
98
99 skip_tx_iqcal:
100 if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
101 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
102 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
103 @@ -4281,18 +4281,10 @@ static int ar9003_hw_tx_power_regwrite(s
104 #undef POW_SM
105 }
106
107 -static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
108 - u8 *targetPowerValT2)
109 +static void ar9003_hw_get_legacy_target_powers(struct ath_hw *ah, u16 freq,
110 + u8 *targetPowerValT2,
111 + bool is2GHz)
112 {
113 - /* XXX: hard code for now, need to get from eeprom struct */
114 - u8 ht40PowerIncForPdadc = 0;
115 - bool is2GHz = false;
116 - unsigned int i = 0;
117 - struct ath_common *common = ath9k_hw_common(ah);
118 -
119 - if (freq < 4000)
120 - is2GHz = true;
121 -
122 targetPowerValT2[ALL_TARGET_LEGACY_6_24] =
123 ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq,
124 is2GHz);
125 @@ -4305,6 +4297,11 @@ static void ar9003_hw_set_target_power_e
126 targetPowerValT2[ALL_TARGET_LEGACY_54] =
127 ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq,
128 is2GHz);
129 +}
130 +
131 +static void ar9003_hw_get_cck_target_powers(struct ath_hw *ah, u16 freq,
132 + u8 *targetPowerValT2)
133 +{
134 targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] =
135 ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L,
136 freq);
137 @@ -4314,6 +4311,11 @@ static void ar9003_hw_set_target_power_e
138 ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq);
139 targetPowerValT2[ALL_TARGET_LEGACY_11S] =
140 ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq);
141 +}
142 +
143 +static void ar9003_hw_get_ht20_target_powers(struct ath_hw *ah, u16 freq,
144 + u8 *targetPowerValT2, bool is2GHz)
145 +{
146 targetPowerValT2[ALL_TARGET_HT20_0_8_16] =
147 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
148 is2GHz);
149 @@ -4356,6 +4358,16 @@ static void ar9003_hw_set_target_power_e
150 targetPowerValT2[ALL_TARGET_HT20_23] =
151 ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
152 is2GHz);
153 +}
154 +
155 +static void ar9003_hw_get_ht40_target_powers(struct ath_hw *ah,
156 + u16 freq,
157 + u8 *targetPowerValT2,
158 + bool is2GHz)
159 +{
160 + /* XXX: hard code for now, need to get from eeprom struct */
161 + u8 ht40PowerIncForPdadc = 0;
162 +
163 targetPowerValT2[ALL_TARGET_HT40_0_8_16] =
164 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
165 is2GHz) + ht40PowerIncForPdadc;
166 @@ -4399,6 +4411,26 @@ static void ar9003_hw_set_target_power_e
167 targetPowerValT2[ALL_TARGET_HT40_23] =
168 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
169 is2GHz) + ht40PowerIncForPdadc;
170 +}
171 +
172 +static void ar9003_hw_get_target_power_eeprom(struct ath_hw *ah,
173 + struct ath9k_channel *chan,
174 + u8 *targetPowerValT2)
175 +{
176 + bool is2GHz = IS_CHAN_2GHZ(chan);
177 + unsigned int i = 0;
178 + struct ath_common *common = ath9k_hw_common(ah);
179 + u16 freq = chan->channel;
180 +
181 + if (is2GHz)
182 + ar9003_hw_get_cck_target_powers(ah, freq, targetPowerValT2);
183 +
184 + ar9003_hw_get_legacy_target_powers(ah, freq, targetPowerValT2, is2GHz);
185 + ar9003_hw_get_ht20_target_powers(ah, freq, targetPowerValT2, is2GHz);
186 +
187 + if (IS_CHAN_HT40(chan))
188 + ar9003_hw_get_ht40_target_powers(ah, freq, targetPowerValT2,
189 + is2GHz);
190
191 for (i = 0; i < ar9300RateSize; i++) {
192 ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n",
193 @@ -4778,9 +4810,6 @@ static void ar9003_hw_set_power_per_rate
194 scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit,
195 antenna_reduction);
196
197 - /*
198 - * Get target powers from EEPROM - our baseline for TX Power
199 - */
200 if (is2ghz) {
201 /* Setup for CTL modes */
202 /* CTL_11B, CTL_11G, CTL_2GHT20 */
203 @@ -4952,7 +4981,12 @@ static void ath9k_hw_ar9300_set_txpower(
204 unsigned int i = 0, paprd_scale_factor = 0;
205 u8 pwr_idx, min_pwridx = 0;
206
207 - ar9003_hw_set_target_power_eeprom(ah, chan->channel, targetPowerValT2);
208 + memset(targetPowerValT2, 0 , sizeof(targetPowerValT2));
209 +
210 + /*
211 + * Get target powers from EEPROM - our baseline for TX Power
212 + */
213 + ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2);
214
215 if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) {
216 if (IS_CHAN_2GHZ(chan))
217 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
218 +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
219 @@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *
220
221 if (val) {
222 ah->paprd_table_write_done = true;
223 - ath9k_hw_apply_txpower(ah, chan);
224 + ath9k_hw_apply_txpower(ah, chan, false);
225 }
226
227 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0,
228 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
229 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
230 @@ -373,7 +373,7 @@ static void ar9003_hw_spur_ofdm_work(str
231 else
232 spur_subchannel_sd = 0;
233
234 - spur_freq_sd = (freq_offset << 9) / 11;
235 + spur_freq_sd = ((freq_offset + 10) << 9) / 11;
236
237 } else {
238 if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL,
239 @@ -382,7 +382,7 @@ static void ar9003_hw_spur_ofdm_work(str
240 else
241 spur_subchannel_sd = 1;
242
243 - spur_freq_sd = (freq_offset << 9) / 11;
244 + spur_freq_sd = ((freq_offset - 10) << 9) / 11;
245
246 }
247
248 @@ -526,22 +526,10 @@ static void ar9003_hw_init_bb(struct ath
249 * Value is in 100ns increments.
250 */
251 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
252 - if (IS_CHAN_B(chan))
253 - synthDelay = (4 * synthDelay) / 22;
254 - else
255 - synthDelay /= 10;
256
257 /* Activate the PHY (includes baseband activate + synthesizer on) */
258 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
259 -
260 - /*
261 - * There is an issue if the AP starts the calibration before
262 - * the base band timeout completes. This could result in the
263 - * rx_clear false triggering. As a workaround we add delay an
264 - * extra BASE_ACTIVATE_DELAY usecs to ensure this condition
265 - * does not happen.
266 - */
267 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
268 + ath9k_hw_synth_delay(ah, chan, synthDelay);
269 }
270
271 static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
272 @@ -692,7 +680,7 @@ static int ar9003_hw_process_ini(struct
273 ar9003_hw_override_ini(ah);
274 ar9003_hw_set_channel_regs(ah, chan);
275 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
276 - ath9k_hw_apply_txpower(ah, chan);
277 + ath9k_hw_apply_txpower(ah, chan, false);
278
279 if (AR_SREV_9462(ah)) {
280 if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0,
281 @@ -723,6 +711,14 @@ static void ar9003_hw_set_rfmode(struct
282
283 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
284 rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE);
285 + if (IS_CHAN_QUARTER_RATE(chan))
286 + rfMode |= AR_PHY_MODE_QUARTER;
287 + if (IS_CHAN_HALF_RATE(chan))
288 + rfMode |= AR_PHY_MODE_HALF;
289 +
290 + if (rfMode & (AR_PHY_MODE_QUARTER | AR_PHY_MODE_HALF))
291 + REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL,
292 + AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW, 3);
293
294 REG_WRITE(ah, AR_PHY_MODE, rfMode);
295 }
296 @@ -793,12 +789,8 @@ static bool ar9003_hw_rfbus_req(struct a
297 static void ar9003_hw_rfbus_done(struct ath_hw *ah)
298 {
299 u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
300 - if (IS_CHAN_B(ah->curchan))
301 - synthDelay = (4 * synthDelay) / 22;
302 - else
303 - synthDelay /= 10;
304
305 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
306 + ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
307
308 REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
309 }
310 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
311 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
312 @@ -468,6 +468,9 @@
313 #define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150)
314 #define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158)
315
316 +#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW 3
317 +#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW_S 0
318 +
319 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00
320 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10
321 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF
322 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
323 +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
324 @@ -798,6 +798,8 @@ static void ath9k_hw_ar9287_set_txpower(
325 regulatory->max_power_level = ratesArray[i];
326 }
327
328 + ath9k_hw_update_regulatory_maxpower(ah);
329 +
330 if (test)
331 return;
332
333 --- a/drivers/net/wireless/ath/ath9k/hw.c
334 +++ b/drivers/net/wireless/ath/ath9k/hw.c
335 @@ -191,6 +191,22 @@ bool ath9k_hw_wait(struct ath_hw *ah, u3
336 }
337 EXPORT_SYMBOL(ath9k_hw_wait);
338
339 +void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
340 + int hw_delay)
341 +{
342 + if (IS_CHAN_B(chan))
343 + hw_delay = (4 * hw_delay) / 22;
344 + else
345 + hw_delay /= 10;
346 +
347 + if (IS_CHAN_HALF_RATE(chan))
348 + hw_delay *= 2;
349 + else if (IS_CHAN_QUARTER_RATE(chan))
350 + hw_delay *= 4;
351 +
352 + udelay(hw_delay + BASE_ACTIVATE_DELAY);
353 +}
354 +
355 void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
356 int column, unsigned int *writecnt)
357 {
358 @@ -1020,7 +1036,7 @@ void ath9k_hw_init_global_settings(struc
359 struct ath_common *common = ath9k_hw_common(ah);
360 struct ieee80211_conf *conf = &common->hw->conf;
361 const struct ath9k_channel *chan = ah->curchan;
362 - int acktimeout, ctstimeout;
363 + int acktimeout, ctstimeout, ack_offset = 0;
364 int slottime;
365 int sifstime;
366 int rx_lat = 0, tx_lat = 0, eifs = 0;
367 @@ -1041,6 +1057,11 @@ void ath9k_hw_init_global_settings(struc
368 rx_lat = 37;
369 tx_lat = 54;
370
371 + if (IS_CHAN_5GHZ(chan))
372 + sifstime = 16;
373 + else
374 + sifstime = 10;
375 +
376 if (IS_CHAN_HALF_RATE(chan)) {
377 eifs = 175;
378 rx_lat *= 2;
379 @@ -1048,8 +1069,9 @@ void ath9k_hw_init_global_settings(struc
380 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
381 tx_lat += 11;
382
383 + sifstime *= 2;
384 + ack_offset = 16;
385 slottime = 13;
386 - sifstime = 32;
387 } else if (IS_CHAN_QUARTER_RATE(chan)) {
388 eifs = 340;
389 rx_lat = (rx_lat * 4) - 1;
390 @@ -1057,8 +1079,9 @@ void ath9k_hw_init_global_settings(struc
391 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
392 tx_lat += 22;
393
394 + sifstime *= 4;
395 + ack_offset = 32;
396 slottime = 21;
397 - sifstime = 64;
398 } else {
399 if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) {
400 eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO;
401 @@ -1072,14 +1095,10 @@ void ath9k_hw_init_global_settings(struc
402 tx_lat = MS(reg, AR_USEC_TX_LAT);
403
404 slottime = ah->slottime;
405 - if (IS_CHAN_5GHZ(chan))
406 - sifstime = 16;
407 - else
408 - sifstime = 10;
409 }
410
411 /* As defined by IEEE 802.11-2007 17.3.8.6 */
412 - acktimeout = slottime + sifstime + 3 * ah->coverage_class;
413 + acktimeout = slottime + sifstime + 3 * ah->coverage_class + ack_offset;
414 ctstimeout = acktimeout;
415
416 /*
417 @@ -1089,7 +1108,8 @@ void ath9k_hw_init_global_settings(struc
418 * BA frames in some implementations, but it has been found to fix ACK
419 * timeout issues in other cases as well.
420 */
421 - if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) {
422 + if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ &&
423 + !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) {
424 acktimeout += 64 - sifstime - ah->slottime;
425 ctstimeout += 48 - sifstime - ah->slottime;
426 }
427 @@ -1469,6 +1489,10 @@ static bool ath9k_hw_channel_change(stru
428 CHANNEL_5GHZ));
429 mode_diff = (chan->chanmode != ah->curchan->chanmode);
430
431 + if ((ah->curchan->channelFlags | chan->channelFlags) &
432 + (CHANNEL_HALF | CHANNEL_QUARTER))
433 + return false;
434 +
435 for (qnum = 0; qnum < AR_NUM_QCU; qnum++) {
436 if (ath9k_hw_numtxpending(ah, qnum)) {
437 ath_dbg(common, QUEUE,
438 @@ -1502,7 +1526,7 @@ static bool ath9k_hw_channel_change(stru
439 return false;
440 }
441 ath9k_hw_set_clockrate(ah);
442 - ath9k_hw_apply_txpower(ah, chan);
443 + ath9k_hw_apply_txpower(ah, chan, false);
444 ath9k_hw_rfbus_done(ah);
445
446 if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
447 @@ -2773,7 +2797,8 @@ static int get_antenna_gain(struct ath_h
448 return ah->eep_ops->get_eeprom(ah, gain_param);
449 }
450
451 -void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan)
452 +void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
453 + bool test)
454 {
455 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
456 struct ieee80211_channel *channel;
457 @@ -2794,7 +2819,7 @@ void ath9k_hw_apply_txpower(struct ath_h
458
459 ah->eep_ops->set_txpower(ah, chan,
460 ath9k_regd_get_ctl(reg, chan),
461 - ant_reduction, new_pwr, false);
462 + ant_reduction, new_pwr, test);
463 }
464
465 void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
466 @@ -2807,7 +2832,7 @@ void ath9k_hw_set_txpowerlimit(struct at
467 if (test)
468 channel->max_power = MAX_RATE_POWER / 2;
469
470 - ath9k_hw_apply_txpower(ah, chan);
471 + ath9k_hw_apply_txpower(ah, chan, test);
472
473 if (test)
474 channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2);
475 --- a/drivers/net/wireless/ath/ath9k/hw.h
476 +++ b/drivers/net/wireless/ath/ath9k/hw.h
477 @@ -923,6 +923,8 @@ void ath9k_hw_set_gpio(struct ath_hw *ah
478 void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
479
480 /* General Operation */
481 +void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
482 + int hw_delay);
483 bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
484 void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
485 int column, unsigned int *writecnt);
486 @@ -982,7 +984,8 @@ void ath9k_hw_name(struct ath_hw *ah, ch
487 /* PHY */
488 void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
489 u32 *coef_mantissa, u32 *coef_exponent);
490 -void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan);
491 +void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
492 + bool test);
493
494 /*
495 * Code Specific to AR5008, AR9001 or AR9002,
496 --- a/drivers/net/wireless/ath/ath9k/init.c
497 +++ b/drivers/net/wireless/ath/ath9k/init.c
498 @@ -647,6 +647,24 @@ void ath9k_reload_chainmask_settings(str
499 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
500 }
501
502 +static const struct ieee80211_iface_limit if_limits[] = {
503 + { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) |
504 + BIT(NL80211_IFTYPE_P2P_CLIENT) |
505 + BIT(NL80211_IFTYPE_WDS) },
506 + { .max = 8, .types =
507 +#ifdef CONFIG_MAC80211_MESH
508 + BIT(NL80211_IFTYPE_MESH_POINT) |
509 +#endif
510 + BIT(NL80211_IFTYPE_AP) |
511 + BIT(NL80211_IFTYPE_P2P_GO) },
512 +};
513 +
514 +static const struct ieee80211_iface_combination if_comb = {
515 + .limits = if_limits,
516 + .n_limits = ARRAY_SIZE(if_limits),
517 + .max_interfaces = 2048,
518 + .num_different_channels = 1,
519 +};
520
521 void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
522 {
523 @@ -676,6 +694,9 @@ void ath9k_set_hw_capab(struct ath_softc
524 BIT(NL80211_IFTYPE_ADHOC) |
525 BIT(NL80211_IFTYPE_MESH_POINT);
526
527 + hw->wiphy->iface_combinations = &if_comb;
528 + hw->wiphy->n_iface_combinations = 1;
529 +
530 if (AR_SREV_5416(sc->sc_ah))
531 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
532
533 --- a/drivers/net/wireless/ath/ath9k/mac.c
534 +++ b/drivers/net/wireless/ath/ath9k/mac.c
535 @@ -133,8 +133,16 @@ EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel
536
537 void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
538 {
539 + int maxdelay = 1000;
540 int i, q;
541
542 + if (ah->curchan) {
543 + if (IS_CHAN_HALF_RATE(ah->curchan))
544 + maxdelay *= 2;
545 + else if (IS_CHAN_QUARTER_RATE(ah->curchan))
546 + maxdelay *= 4;
547 + }
548 +
549 REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
550
551 REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
552 @@ -142,7 +150,7 @@ void ath9k_hw_abort_tx_dma(struct ath_hw
553 REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
554
555 for (q = 0; q < AR_NUM_QCU; q++) {
556 - for (i = 0; i < 1000; i++) {
557 + for (i = 0; i < maxdelay; i++) {
558 if (i)
559 udelay(5);
560
561 --- a/net/mac80211/agg-rx.c
562 +++ b/net/mac80211/agg-rx.c
563 @@ -200,6 +200,8 @@ static void ieee80211_send_addba_resp(st
564 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
565 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
566 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
567 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
568 + memcpy(mgmt->bssid, da, ETH_ALEN);
569
570 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
571 IEEE80211_STYPE_ACTION);
572 --- a/net/mac80211/agg-tx.c
573 +++ b/net/mac80211/agg-tx.c
574 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
575 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
576 if (sdata->vif.type == NL80211_IFTYPE_AP ||
577 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
578 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
579 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
580 + sdata->vif.type == NL80211_IFTYPE_WDS)
581 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
582 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
583 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
584 @@ -484,6 +485,7 @@ int ieee80211_start_tx_ba_session(struct
585 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
586 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
587 sdata->vif.type != NL80211_IFTYPE_AP &&
588 + sdata->vif.type != NL80211_IFTYPE_WDS &&
589 sdata->vif.type != NL80211_IFTYPE_ADHOC)
590 return -EINVAL;
591
592 --- a/net/mac80211/debugfs_sta.c
593 +++ b/net/mac80211/debugfs_sta.c
594 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
595 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
596
597 int res = scnprintf(buf, sizeof(buf),
598 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
599 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
600 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
601 TEST(PS_DRIVER), TEST(AUTHORIZED),
602 TEST(SHORT_PREAMBLE),
603 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
604 + TEST(WME), TEST(CLEAR_PS_FILT),
605 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
606 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
607 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
608 --- a/net/mac80211/iface.c
609 +++ b/net/mac80211/iface.c
610 @@ -206,8 +206,10 @@ static void ieee80211_set_default_queues
611 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
612 if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)
613 sdata->vif.hw_queue[i] = IEEE80211_INVAL_HW_QUEUE;
614 - else
615 + else if (local->hw.queues >= IEEE80211_NUM_ACS)
616 sdata->vif.hw_queue[i] = i;
617 + else
618 + sdata->vif.hw_queue[i] = 0;
619 }
620 sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE;
621 }
622 @@ -282,7 +284,6 @@ static int ieee80211_do_open(struct net_
623 {
624 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
625 struct ieee80211_local *local = sdata->local;
626 - struct sta_info *sta;
627 u32 changed = 0;
628 int res;
629 u32 hw_reconf_flags = 0;
630 @@ -428,28 +429,6 @@ static int ieee80211_do_open(struct net_
631
632 set_bit(SDATA_STATE_RUNNING, &sdata->state);
633
634 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
635 - /* Create STA entry for the WDS peer */
636 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
637 - GFP_KERNEL);
638 - if (!sta) {
639 - res = -ENOMEM;
640 - goto err_del_interface;
641 - }
642 -
643 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
644 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
645 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
646 -
647 - res = sta_info_insert(sta);
648 - if (res) {
649 - /* STA has been freed */
650 - goto err_del_interface;
651 - }
652 -
653 - rate_control_rate_init(sta);
654 - }
655 -
656 /*
657 * set_multicast_list will be invoked by the networking core
658 * which will check whether any increments here were done in
659 @@ -846,6 +825,72 @@ static void ieee80211_if_setup(struct ne
660 dev->destructor = free_netdev;
661 }
662
663 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
664 + struct sk_buff *skb)
665 +{
666 + struct ieee80211_local *local = sdata->local;
667 + struct ieee80211_rx_status *rx_status;
668 + struct ieee802_11_elems elems;
669 + struct ieee80211_mgmt *mgmt;
670 + struct sta_info *sta;
671 + size_t baselen;
672 + u32 rates = 0;
673 + u16 stype;
674 + bool new = false;
675 + enum ieee80211_band band = local->hw.conf.channel->band;
676 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
677 +
678 + rx_status = IEEE80211_SKB_RXCB(skb);
679 + mgmt = (struct ieee80211_mgmt *) skb->data;
680 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
681 +
682 + if (stype != IEEE80211_STYPE_BEACON)
683 + return;
684 +
685 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
686 + if (baselen > skb->len)
687 + return;
688 +
689 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
690 + skb->len - baselen, &elems);
691 +
692 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
693 +
694 + rcu_read_lock();
695 +
696 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
697 +
698 + if (!sta) {
699 + rcu_read_unlock();
700 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
701 + GFP_KERNEL);
702 + if (!sta)
703 + return;
704 +
705 + new = true;
706 + }
707 +
708 + sta->last_rx = jiffies;
709 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
710 +
711 + if (elems.ht_cap_elem)
712 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
713 + elems.ht_cap_elem, &sta->sta.ht_cap);
714 +
715 + if (elems.wmm_param)
716 + set_sta_flag(sta, WLAN_STA_WME);
717 +
718 + if (new) {
719 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
720 + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
721 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
722 + rate_control_rate_init(sta);
723 + sta_info_insert_rcu(sta);
724 + }
725 +
726 + rcu_read_unlock();
727 +}
728 +
729 static void ieee80211_iface_work(struct work_struct *work)
730 {
731 struct ieee80211_sub_if_data *sdata =
732 @@ -950,6 +995,9 @@ static void ieee80211_iface_work(struct
733 break;
734 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
735 break;
736 + case NL80211_IFTYPE_WDS:
737 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
738 + break;
739 default:
740 WARN(1, "frame for unexpected interface type");
741 break;
742 --- a/net/mac80211/rx.c
743 +++ b/net/mac80211/rx.c
744 @@ -2283,6 +2283,7 @@ ieee80211_rx_h_action(struct ieee80211_r
745 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
746 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
747 sdata->vif.type != NL80211_IFTYPE_AP &&
748 + sdata->vif.type != NL80211_IFTYPE_WDS &&
749 sdata->vif.type != NL80211_IFTYPE_ADHOC)
750 break;
751
752 @@ -2497,14 +2498,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
753
754 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
755 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
756 - sdata->vif.type != NL80211_IFTYPE_STATION)
757 + sdata->vif.type != NL80211_IFTYPE_STATION &&
758 + sdata->vif.type != NL80211_IFTYPE_WDS)
759 return RX_DROP_MONITOR;
760
761 switch (stype) {
762 case cpu_to_le16(IEEE80211_STYPE_AUTH):
763 case cpu_to_le16(IEEE80211_STYPE_BEACON):
764 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
765 - /* process for all: mesh, mlme, ibss */
766 + /* process for all: mesh, mlme, ibss, wds */
767 break;
768 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
769 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
770 @@ -2838,10 +2840,16 @@ static int prepare_for_handlers(struct i
771 }
772 break;
773 case NL80211_IFTYPE_WDS:
774 - if (bssid || !ieee80211_is_data(hdr->frame_control))
775 - return 0;
776 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
777 return 0;
778 +
779 + if (ieee80211_is_data(hdr->frame_control) ||
780 + ieee80211_is_action(hdr->frame_control)) {
781 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
782 + return 0;
783 + } else if (!ieee80211_is_beacon(hdr->frame_control))
784 + return 0;
785 +
786 break;
787 default:
788 /* should never get here */
789 --- a/net/mac80211/sta_info.h
790 +++ b/net/mac80211/sta_info.h
791 @@ -32,7 +32,6 @@
792 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
793 * frames.
794 * @WLAN_STA_WME: Station is a QoS-STA.
795 - * @WLAN_STA_WDS: Station is one of our WDS peers.
796 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
797 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
798 * frame to this station is transmitted.
799 @@ -64,7 +63,6 @@ enum ieee80211_sta_info_flags {
800 WLAN_STA_AUTHORIZED,
801 WLAN_STA_SHORT_PREAMBLE,
802 WLAN_STA_WME,
803 - WLAN_STA_WDS,
804 WLAN_STA_CLEAR_PS_FILT,
805 WLAN_STA_MFP,
806 WLAN_STA_BLOCK_BA,
807 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h
808 +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
809 @@ -425,6 +425,7 @@ void iwl_testmode_cleanup(struct iwl_pri
810 #ifdef CONFIG_IWLWIFI_DEBUG
811 void iwl_print_rx_config_cmd(struct iwl_priv *priv,
812 enum iwl_rxon_context_id ctxid);
813 +int iwl_alloc_traffic_mem(struct iwl_priv *priv);
814 #else
815 static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
816 enum iwl_rxon_context_id ctxid)
817 @@ -510,7 +511,6 @@ void iwl_setup_deferred_work(struct iwl_
818 int iwl_send_wimax_coex(struct iwl_priv *priv);
819 int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type);
820 void iwl_debug_config(struct iwl_priv *priv);
821 -int iwl_alloc_traffic_mem(struct iwl_priv *priv);
822 void iwl_set_hw_params(struct iwl_priv *priv);
823 void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags);
824 int iwl_init_drv(struct iwl_priv *priv);
825 --- a/drivers/net/wireless/libertas/firmware.c
826 +++ b/drivers/net/wireless/libertas/firmware.c
827 @@ -5,6 +5,7 @@
828 #include <linux/firmware.h>
829 #include <linux/firmware.h>
830 #include <linux/module.h>
831 +#include <linux/sched.h>
832
833 #include "dev.h"
834 #include "decl.h"
835 --- a/drivers/net/wireless/ath/ath9k/recv.c
836 +++ b/drivers/net/wireless/ath/ath9k/recv.c
837 @@ -812,6 +812,7 @@ static bool ath9k_rx_accept(struct ath_c
838 is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID &&
839 test_bit(rx_stats->rs_keyix, common->tkip_keymap);
840 strip_mic = is_valid_tkip && ieee80211_is_data(fc) &&
841 + ieee80211_has_protected(fc) &&
842 !(rx_stats->rs_status &
843 (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC |
844 ATH9K_RXERR_KEYMISS));
845 --- a/net/mac80211/cfg.c
846 +++ b/net/mac80211/cfg.c
847 @@ -1005,6 +1005,9 @@ static int ieee80211_change_station(stru
848 }
849
850 if (params->vlan && params->vlan != sta->sdata->dev) {
851 + bool prev_4addr = false;
852 + bool new_4addr = false;
853 +
854 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
855
856 if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
857 @@ -1020,9 +1023,25 @@ static int ieee80211_change_station(stru
858 }
859
860 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
861 + new_4addr = true;
862 + }
863 +
864 + if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
865 + sta->sdata->u.vlan.sta) {
866 + rcu_assign_pointer(sta->sdata->u.vlan.sta, NULL);
867 + prev_4addr = true;
868 }
869
870 sta->sdata = vlansdata;
871 +
872 + if (sta->sta_state == IEEE80211_STA_AUTHORIZED &&
873 + prev_4addr != new_4addr) {
874 + if (new_4addr)
875 + atomic_dec(&sta->sdata->bss->num_mcast_sta);
876 + else
877 + atomic_inc(&sta->sdata->bss->num_mcast_sta);
878 + }
879 +
880 ieee80211_send_layer2_update(sta);
881 }
882
883 --- a/net/mac80211/debugfs_netdev.c
884 +++ b/net/mac80211/debugfs_netdev.c
885 @@ -394,7 +394,7 @@ static ssize_t ieee80211_if_parse_uapsd_
886 __IEEE80211_IF_FILE_W(uapsd_max_sp_len);
887
888 /* AP attributes */
889 -IEEE80211_IF_FILE(num_sta_authorized, u.ap.num_sta_authorized, ATOMIC);
890 +IEEE80211_IF_FILE(num_mcast_sta, u.ap.num_mcast_sta, ATOMIC);
891 IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC);
892 IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC);
893
894 @@ -540,7 +540,7 @@ static void add_sta_files(struct ieee802
895
896 static void add_ap_files(struct ieee80211_sub_if_data *sdata)
897 {
898 - DEBUGFS_ADD(num_sta_authorized);
899 + DEBUGFS_ADD(num_mcast_sta);
900 DEBUGFS_ADD(num_sta_ps);
901 DEBUGFS_ADD(dtim_count);
902 DEBUGFS_ADD(num_buffered_multicast);
903 --- a/net/mac80211/ieee80211_i.h
904 +++ b/net/mac80211/ieee80211_i.h
905 @@ -282,7 +282,7 @@ struct ieee80211_if_ap {
906 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
907 struct sk_buff_head ps_bc_buf;
908 atomic_t num_sta_ps; /* number of stations in PS mode */
909 - atomic_t num_sta_authorized; /* number of authorized stations */
910 + atomic_t num_mcast_sta; /* number of stations receiving multicast */
911 int dtim_count;
912 bool dtim_bc_mc;
913 };
914 --- a/net/mac80211/sta_info.c
915 +++ b/net/mac80211/sta_info.c
916 @@ -1417,15 +1417,19 @@ int sta_info_move_state(struct sta_info
917 if (sta->sta_state == IEEE80211_STA_AUTH) {
918 set_bit(WLAN_STA_ASSOC, &sta->_flags);
919 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
920 - if (sta->sdata->vif.type == NL80211_IFTYPE_AP)
921 - atomic_dec(&sta->sdata->u.ap.num_sta_authorized);
922 + if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
923 + (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
924 + !sta->sdata->u.vlan.sta))
925 + atomic_dec(&sta->sdata->bss->num_mcast_sta);
926 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
927 }
928 break;
929 case IEEE80211_STA_AUTHORIZED:
930 if (sta->sta_state == IEEE80211_STA_ASSOC) {
931 - if (sta->sdata->vif.type == NL80211_IFTYPE_AP)
932 - atomic_inc(&sta->sdata->u.ap.num_sta_authorized);
933 + if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
934 + (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
935 + !sta->sdata->u.vlan.sta))
936 + atomic_inc(&sta->sdata->bss->num_mcast_sta);
937 set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
938 }
939 break;
940 --- a/net/mac80211/tx.c
941 +++ b/net/mac80211/tx.c
942 @@ -306,7 +306,7 @@ ieee80211_tx_h_check_assoc(struct ieee80
943 }
944 } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP &&
945 ieee80211_is_data(hdr->frame_control) &&
946 - !atomic_read(&tx->sdata->u.ap.num_sta_authorized))) {
947 + !atomic_read(&tx->sdata->u.ap.num_mcast_sta))) {
948 /*
949 * No associated STAs - no need to send multicast
950 * frames.
951 @@ -1159,7 +1159,8 @@ ieee80211_tx_prepare(struct ieee80211_su
952 tx->sta = rcu_dereference(sdata->u.vlan.sta);
953 if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
954 return TX_DROP;
955 - } else if (info->flags & IEEE80211_TX_CTL_INJECTED) {
956 + } else if (info->flags & IEEE80211_TX_CTL_INJECTED ||
957 + tx->sdata->control_port_protocol == tx->skb->protocol) {
958 tx->sta = sta_info_get_bss(sdata, hdr->addr1);
959 }
960 if (!tx->sta)
961 --- a/net/wireless/scan.c
962 +++ b/net/wireless/scan.c
963 @@ -378,7 +378,11 @@ static int cmp_bss_core(struct cfg80211_
964 b->len_information_elements);
965 }
966
967 - return compare_ether_addr(a->bssid, b->bssid);
968 + /*
969 + * we can't use compare_ether_addr here since we need a < > operator.
970 + * The binary return value of compare_ether_addr isn't enough
971 + */
972 + return memcmp(a->bssid, b->bssid, sizeof(a->bssid));
973 }
974
975 static int cmp_bss(struct cfg80211_bss *a,