1 --- a/drivers/net/wireless/ath/ath5k/base.c
2 +++ b/drivers/net/wireless/ath/ath5k/base.c
3 @@ -1171,7 +1171,7 @@ ath5k_check_ibss_tsf(struct ath5k_hw *ah
5 if (ieee80211_is_beacon(mgmt->frame_control) &&
6 le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS &&
7 - memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) == 0) {
8 + compare_ether_addr(mgmt->bssid, common->curbssid) == 0) {
10 * Received an IBSS beacon with the same BSSID. Hardware *must*
11 * have updated the local TSF. We have to work around various
12 @@ -1235,7 +1235,7 @@ ath5k_update_beacon_rssi(struct ath5k_hw
14 /* only beacons from our BSSID */
15 if (!ieee80211_is_beacon(mgmt->frame_control) ||
16 - memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) != 0)
17 + compare_ether_addr(mgmt->bssid, common->curbssid) != 0)
20 ewma_add(&ah->ah_beacon_rssi_avg, rssi);
21 @@ -2416,6 +2416,22 @@ ath5k_tx_complete_poll_work(struct work_
22 * Initialization routines *
23 \*************************/
25 +static const struct ieee80211_iface_limit if_limits[] = {
26 + { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) },
27 + { .max = 4, .types =
28 +#ifdef CONFIG_MAC80211_MESH
29 + BIT(NL80211_IFTYPE_MESH_POINT) |
31 + BIT(NL80211_IFTYPE_AP) },
34 +static const struct ieee80211_iface_combination if_comb = {
35 + .limits = if_limits,
36 + .n_limits = ARRAY_SIZE(if_limits),
37 + .max_interfaces = 2048,
38 + .num_different_channels = 1,
42 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
44 @@ -2437,6 +2453,9 @@ ath5k_init_ah(struct ath5k_hw *ah, const
45 BIT(NL80211_IFTYPE_ADHOC) |
46 BIT(NL80211_IFTYPE_MESH_POINT);
48 + hw->wiphy->iface_combinations = &if_comb;
49 + hw->wiphy->n_iface_combinations = 1;
51 /* SW support for IBSS_RSN is provided by mac80211 */
52 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
54 --- a/drivers/net/wireless/ath/ath9k/ani.c
55 +++ b/drivers/net/wireless/ath/ath9k/ani.c
56 @@ -274,7 +274,9 @@ static void ath9k_hw_set_ofdm_nil(struct
57 aniState->rssiThrLow, aniState->rssiThrHigh);
59 if (aniState->update_ani)
60 - aniState->ofdmNoiseImmunityLevel = immunityLevel;
61 + aniState->ofdmNoiseImmunityLevel =
62 + (immunityLevel > ATH9K_ANI_OFDM_DEF_LEVEL) ?
63 + immunityLevel : ATH9K_ANI_OFDM_DEF_LEVEL;
65 entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
66 entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
67 @@ -340,7 +342,9 @@ static void ath9k_hw_set_cck_nil(struct
68 immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
70 if (aniState->update_ani)
71 - aniState->cckNoiseImmunityLevel = immunityLevel;
72 + aniState->cckNoiseImmunityLevel =
73 + (immunityLevel > ATH9K_ANI_CCK_DEF_LEVEL) ?
74 + immunityLevel : ATH9K_ANI_CCK_DEF_LEVEL;
76 entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
77 entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
78 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
79 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
80 @@ -618,19 +618,10 @@ static void ar5008_hw_init_bb(struct ath
83 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
84 - if (IS_CHAN_B(chan))
85 - synthDelay = (4 * synthDelay) / 22;
89 - if (IS_CHAN_HALF_RATE(chan))
91 - else if (IS_CHAN_QUARTER_RATE(chan))
94 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
96 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
97 + ath9k_hw_synth_delay(ah, chan, synthDelay);
100 static void ar5008_hw_init_chain_masks(struct ath_hw *ah)
101 @@ -868,7 +859,7 @@ static int ar5008_hw_process_ini(struct
102 ar5008_hw_set_channel_regs(ah, chan);
103 ar5008_hw_init_chain_masks(ah);
105 - ath9k_hw_apply_txpower(ah, chan);
106 + ath9k_hw_apply_txpower(ah, chan, false);
108 /* Write analog registers */
109 if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) {
110 @@ -948,12 +939,8 @@ static bool ar5008_hw_rfbus_req(struct a
111 static void ar5008_hw_rfbus_done(struct ath_hw *ah)
113 u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
114 - if (IS_CHAN_B(ah->curchan))
115 - synthDelay = (4 * synthDelay) / 22;
119 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
120 + ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
122 REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
124 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
125 +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
126 @@ -1000,10 +1000,12 @@ static bool ar9003_hw_init_cal(struct at
127 if (mci && IS_CHAN_2GHZ(chan) && run_agc_cal)
128 ar9003_mci_init_cal_req(ah, &is_reusable);
130 - txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
131 - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
133 - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
134 + if (!(IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan))) {
135 + txiqcal_done = ar9003_hw_tx_iq_cal_run(ah);
136 + REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
138 + REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
142 if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
143 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
144 +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
145 @@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *
148 ah->paprd_table_write_done = true;
149 - ath9k_hw_apply_txpower(ah, chan);
150 + ath9k_hw_apply_txpower(ah, chan, false);
153 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0,
154 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
155 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
156 @@ -524,22 +524,10 @@ static void ar9003_hw_init_bb(struct ath
157 * Value is in 100ns increments.
159 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
160 - if (IS_CHAN_B(chan))
161 - synthDelay = (4 * synthDelay) / 22;
165 /* Activate the PHY (includes baseband activate + synthesizer on) */
166 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
169 - * There is an issue if the AP starts the calibration before
170 - * the base band timeout completes. This could result in the
171 - * rx_clear false triggering. As a workaround we add delay an
172 - * extra BASE_ACTIVATE_DELAY usecs to ensure this condition
175 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
176 + ath9k_hw_synth_delay(ah, chan, synthDelay);
179 static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
180 @@ -690,7 +678,7 @@ static int ar9003_hw_process_ini(struct
181 ar9003_hw_override_ini(ah);
182 ar9003_hw_set_channel_regs(ah, chan);
183 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
184 - ath9k_hw_apply_txpower(ah, chan);
185 + ath9k_hw_apply_txpower(ah, chan, false);
187 if (AR_SREV_9462(ah)) {
188 if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0,
189 @@ -721,6 +709,14 @@ static void ar9003_hw_set_rfmode(struct
191 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
192 rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE);
193 + if (IS_CHAN_QUARTER_RATE(chan))
194 + rfMode |= AR_PHY_MODE_QUARTER;
195 + if (IS_CHAN_HALF_RATE(chan))
196 + rfMode |= AR_PHY_MODE_HALF;
198 + if (rfMode & (AR_PHY_MODE_QUARTER | AR_PHY_MODE_HALF))
199 + REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL,
200 + AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW, 3);
202 REG_WRITE(ah, AR_PHY_MODE, rfMode);
204 @@ -791,12 +787,8 @@ static bool ar9003_hw_rfbus_req(struct a
205 static void ar9003_hw_rfbus_done(struct ath_hw *ah)
207 u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY;
208 - if (IS_CHAN_B(ah->curchan))
209 - synthDelay = (4 * synthDelay) / 22;
213 - udelay(synthDelay + BASE_ACTIVATE_DELAY);
214 + ath9k_hw_synth_delay(ah, ah->curchan, synthDelay);
216 REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0);
218 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
219 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
221 #define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150)
222 #define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158)
224 +#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW 3
225 +#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW_S 0
227 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00
228 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10
229 #define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF
230 --- a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h
231 +++ b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h
232 @@ -1115,9 +1115,9 @@ static const u32 ar9462_2p0_mac_core[][2
233 {0x000081f8, 0x00000000},
234 {0x000081fc, 0x00000000},
235 {0x00008240, 0x00100000},
236 - {0x00008244, 0x0010f400},
237 + {0x00008244, 0x0010f424},
238 {0x00008248, 0x00000800},
239 - {0x0000824c, 0x0001e800},
240 + {0x0000824c, 0x0001e848},
241 {0x00008250, 0x00000000},
242 {0x00008254, 0x00000000},
243 {0x00008258, 0x00000000},
244 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
245 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
246 @@ -370,7 +370,7 @@ struct ath_vif {
247 * number of beacon intervals, the game's up.
249 #define BSTUCK_THRESH 9
252 #define ATH_DEFAULT_BINTVAL 100 /* TU */
253 #define ATH_DEFAULT_BMISS_LIMIT 10
254 #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
255 --- a/drivers/net/wireless/ath/ath9k/beacon.c
256 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
257 @@ -91,7 +91,7 @@ static void ath_beacon_setup(struct ath_
258 info.txpower = MAX_RATE_POWER;
259 info.keyix = ATH9K_TXKEYIX_INVALID;
260 info.keytype = ATH9K_KEY_TYPE_CLEAR;
261 - info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_INTREQ;
262 + info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_CLRDMASK;
264 info.buf_addr[0] = bf->bf_buf_addr;
265 info.buf_len[0] = roundup(skb->len, 4);
266 @@ -359,6 +359,11 @@ void ath_beacon_tasklet(unsigned long da
270 + if (work_pending(&sc->hw_reset_work)) {
271 + ath_dbg(common, RESET,
272 + "reset work is pending, skip beaconing now\n");
276 * Check if the previous beacon has gone out. If
277 * not don't try to post another, skip this period
278 @@ -369,6 +374,9 @@ void ath_beacon_tasklet(unsigned long da
279 if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0) {
280 sc->beacon.bmisscnt++;
282 + if (!ath9k_hw_check_alive(ah))
283 + ieee80211_queue_work(sc->hw, &sc->hw_check_work);
285 if (sc->beacon.bmisscnt < BSTUCK_THRESH * sc->nbcnvifs) {
286 ath_dbg(common, BSTUCK,
287 "missed %u consecutive beacons\n",
288 @@ -378,6 +386,7 @@ void ath_beacon_tasklet(unsigned long da
289 ath9k_hw_bstuck_nfcal(ah);
290 } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) {
291 ath_dbg(common, BSTUCK, "beacon is officially stuck\n");
292 + sc->beacon.bmisscnt = 0;
293 sc->sc_flags |= SC_OP_TSF_RESET;
294 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
296 @@ -650,6 +659,8 @@ static void ath_beacon_config_adhoc(stru
297 u32 tsf, intval, nexttbtt;
299 ath9k_reset_beacon_status(sc);
300 + if (!(sc->sc_flags & SC_OP_BEACONS))
301 + ath9k_hw_settsf64(ah, sc->beacon.bc_tstamp);
303 intval = TU_TO_USEC(conf->beacon_interval);
304 tsf = roundup(ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE), intval);
305 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
306 +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
307 @@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(
308 regulatory->max_power_level = ratesArray[i];
311 + ath9k_hw_update_regulatory_maxpower(ah);
316 --- a/drivers/net/wireless/ath/ath9k/gpio.c
317 +++ b/drivers/net/wireless/ath/ath9k/gpio.c
318 @@ -41,6 +41,9 @@ void ath_init_leds(struct ath_softc *sc)
322 + if (AR_SREV_9100(sc->sc_ah))
325 if (sc->sc_ah->led_pin < 0) {
326 if (AR_SREV_9287(sc->sc_ah))
327 sc->sc_ah->led_pin = ATH_LED_PIN_9287;
328 --- a/drivers/net/wireless/ath/ath9k/hw.c
329 +++ b/drivers/net/wireless/ath/ath9k/hw.c
330 @@ -142,6 +142,22 @@ bool ath9k_hw_wait(struct ath_hw *ah, u3
332 EXPORT_SYMBOL(ath9k_hw_wait);
334 +void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
337 + if (IS_CHAN_B(chan))
338 + hw_delay = (4 * hw_delay) / 22;
342 + if (IS_CHAN_HALF_RATE(chan))
344 + else if (IS_CHAN_QUARTER_RATE(chan))
347 + udelay(hw_delay + BASE_ACTIVATE_DELAY);
350 void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
351 int column, unsigned int *writecnt)
353 @@ -388,8 +404,8 @@ static void ath9k_hw_init_config(struct
357 - ah->config.dma_beacon_response_time = 2;
358 - ah->config.sw_beacon_response_time = 10;
359 + ah->config.dma_beacon_response_time = 1;
360 + ah->config.sw_beacon_response_time = 6;
361 ah->config.additional_swba_backoff = 0;
362 ah->config.ack_6mb = 0x0;
363 ah->config.cwm_ignore_extcca = 0;
364 @@ -971,7 +987,7 @@ void ath9k_hw_init_global_settings(struc
365 struct ath_common *common = ath9k_hw_common(ah);
366 struct ieee80211_conf *conf = &common->hw->conf;
367 const struct ath9k_channel *chan = ah->curchan;
368 - int acktimeout, ctstimeout;
369 + int acktimeout, ctstimeout, ack_offset = 0;
372 int rx_lat = 0, tx_lat = 0, eifs = 0;
373 @@ -992,6 +1008,11 @@ void ath9k_hw_init_global_settings(struc
377 + if (IS_CHAN_5GHZ(chan))
382 if (IS_CHAN_HALF_RATE(chan)) {
385 @@ -999,8 +1020,9 @@ void ath9k_hw_init_global_settings(struc
386 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
393 } else if (IS_CHAN_QUARTER_RATE(chan)) {
395 rx_lat = (rx_lat * 4) - 1;
396 @@ -1008,8 +1030,9 @@ void ath9k_hw_init_global_settings(struc
397 if (IS_CHAN_A_FAST_CLOCK(ah, chan))
405 if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) {
406 eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO;
407 @@ -1023,14 +1046,10 @@ void ath9k_hw_init_global_settings(struc
408 tx_lat = MS(reg, AR_USEC_TX_LAT);
410 slottime = ah->slottime;
411 - if (IS_CHAN_5GHZ(chan))
417 /* As defined by IEEE 802.11-2007 17.3.8.6 */
418 - acktimeout = slottime + sifstime + 3 * ah->coverage_class;
419 + acktimeout = slottime + sifstime + 3 * ah->coverage_class + ack_offset;
420 ctstimeout = acktimeout;
423 @@ -1040,7 +1059,8 @@ void ath9k_hw_init_global_settings(struc
424 * BA frames in some implementations, but it has been found to fix ACK
425 * timeout issues in other cases as well.
427 - if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) {
428 + if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ &&
429 + !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) {
430 acktimeout += 64 - sifstime - ah->slottime;
431 ctstimeout += 48 - sifstime - ah->slottime;
433 @@ -1420,6 +1440,10 @@ static bool ath9k_hw_channel_change(stru
435 mode_diff = (chan->chanmode != ah->curchan->chanmode);
437 + if ((ah->curchan->channelFlags | chan->channelFlags) &
438 + (CHANNEL_HALF | CHANNEL_QUARTER))
441 for (qnum = 0; qnum < AR_NUM_QCU; qnum++) {
442 if (ath9k_hw_numtxpending(ah, qnum)) {
443 ath_dbg(common, QUEUE,
444 @@ -1453,7 +1477,7 @@ static bool ath9k_hw_channel_change(stru
447 ath9k_hw_set_clockrate(ah);
448 - ath9k_hw_apply_txpower(ah, chan);
449 + ath9k_hw_apply_txpower(ah, chan, false);
450 ath9k_hw_rfbus_done(ah);
452 if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
453 @@ -2724,7 +2748,8 @@ static int get_antenna_gain(struct ath_h
454 return ah->eep_ops->get_eeprom(ah, gain_param);
457 -void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan)
458 +void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
461 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
462 struct ieee80211_channel *channel;
463 @@ -2745,7 +2770,7 @@ void ath9k_hw_apply_txpower(struct ath_h
465 ah->eep_ops->set_txpower(ah, chan,
466 ath9k_regd_get_ctl(reg, chan),
467 - ant_reduction, new_pwr, false);
468 + ant_reduction, new_pwr, test);
471 void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
472 @@ -2758,7 +2783,7 @@ void ath9k_hw_set_txpowerlimit(struct at
474 channel->max_power = MAX_RATE_POWER / 2;
476 - ath9k_hw_apply_txpower(ah, chan);
477 + ath9k_hw_apply_txpower(ah, chan, test);
480 channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2);
481 --- a/drivers/net/wireless/ath/ath9k/hw.h
482 +++ b/drivers/net/wireless/ath/ath9k/hw.h
483 @@ -923,6 +923,8 @@ void ath9k_hw_set_gpio(struct ath_hw *ah
484 void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
486 /* General Operation */
487 +void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan,
489 bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
490 void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array,
491 int column, unsigned int *writecnt);
492 @@ -976,7 +978,8 @@ void ath9k_hw_name(struct ath_hw *ah, ch
494 void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
495 u32 *coef_mantissa, u32 *coef_exponent);
496 -void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan);
497 +void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
501 * Code Specific to AR5008, AR9001 or AR9002,
502 --- a/drivers/net/wireless/ath/ath9k/mac.c
503 +++ b/drivers/net/wireless/ath/ath9k/mac.c
504 @@ -133,8 +133,16 @@ EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel
506 void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
508 + int maxdelay = 1000;
512 + if (IS_CHAN_HALF_RATE(ah->curchan))
514 + else if (IS_CHAN_QUARTER_RATE(ah->curchan))
518 REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
520 REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
521 @@ -142,7 +150,7 @@ void ath9k_hw_abort_tx_dma(struct ath_hw
522 REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
524 for (q = 0; q < AR_NUM_QCU; q++) {
525 - for (i = 0; i < 1000; i++) {
526 + for (i = 0; i < maxdelay; i++) {
530 --- a/drivers/net/wireless/ath/ath9k/main.c
531 +++ b/drivers/net/wireless/ath/ath9k/main.c
532 @@ -692,17 +692,6 @@ void ath9k_tasklet(unsigned long data)
537 - * Only run the baseband hang check if beacons stop working in AP or
538 - * IBSS mode, because it has a high false positive rate. For station
539 - * mode it should not be necessary, since the upper layers will detect
540 - * this through a beacon miss automatically and the following channel
541 - * change will trigger a hardware reset anyway
543 - if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0 &&
544 - !ath9k_hw_check_alive(ah))
545 - ieee80211_queue_work(sc->hw, &sc->hw_check_work);
547 if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) {
549 * TSF sync does not look correct; remain awake to sync with
550 --- a/net/mac80211/agg-rx.c
551 +++ b/net/mac80211/agg-rx.c
552 @@ -200,6 +200,8 @@ static void ieee80211_send_addba_resp(st
553 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
554 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
555 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
556 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
557 + memcpy(mgmt->bssid, da, ETH_ALEN);
559 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
560 IEEE80211_STYPE_ACTION);
561 --- a/net/mac80211/agg-tx.c
562 +++ b/net/mac80211/agg-tx.c
563 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
564 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
565 if (sdata->vif.type == NL80211_IFTYPE_AP ||
566 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
567 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
568 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
569 + sdata->vif.type == NL80211_IFTYPE_WDS)
570 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
571 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
572 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
573 @@ -484,6 +485,7 @@ int ieee80211_start_tx_ba_session(struct
574 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
575 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
576 sdata->vif.type != NL80211_IFTYPE_AP &&
577 + sdata->vif.type != NL80211_IFTYPE_WDS &&
578 sdata->vif.type != NL80211_IFTYPE_ADHOC)
581 --- a/net/mac80211/debugfs_sta.c
582 +++ b/net/mac80211/debugfs_sta.c
583 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
584 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
586 int res = scnprintf(buf, sizeof(buf),
587 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
588 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
589 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
590 TEST(PS_DRIVER), TEST(AUTHORIZED),
591 TEST(SHORT_PREAMBLE),
592 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
593 + TEST(WME), TEST(CLEAR_PS_FILT),
594 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
595 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
596 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
597 --- a/net/mac80211/iface.c
598 +++ b/net/mac80211/iface.c
599 @@ -163,7 +163,8 @@ static int ieee80211_check_queues(struct
603 - if (sdata->vif.type != NL80211_IFTYPE_AP) {
604 + if ((sdata->vif.type != NL80211_IFTYPE_AP) ||
605 + !(sdata->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) {
606 sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE;
609 @@ -281,7 +282,6 @@ static int ieee80211_do_open(struct net_
611 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
612 struct ieee80211_local *local = sdata->local;
613 - struct sta_info *sta;
616 u32 hw_reconf_flags = 0;
617 @@ -427,28 +427,6 @@ static int ieee80211_do_open(struct net_
619 set_bit(SDATA_STATE_RUNNING, &sdata->state);
621 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
622 - /* Create STA entry for the WDS peer */
623 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
627 - goto err_del_interface;
630 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
631 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
632 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
634 - res = sta_info_insert(sta);
636 - /* STA has been freed */
637 - goto err_del_interface;
640 - rate_control_rate_init(sta);
644 * set_multicast_list will be invoked by the networking core
645 * which will check whether any increments here were done in
646 @@ -845,6 +823,70 @@ static void ieee80211_if_setup(struct ne
647 dev->destructor = free_netdev;
650 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
651 + struct sk_buff *skb)
653 + struct ieee80211_local *local = sdata->local;
654 + struct ieee80211_rx_status *rx_status;
655 + struct ieee802_11_elems elems;
656 + struct ieee80211_mgmt *mgmt;
657 + struct sta_info *sta;
662 + enum ieee80211_band band = local->hw.conf.channel->band;
663 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
665 + rx_status = IEEE80211_SKB_RXCB(skb);
666 + mgmt = (struct ieee80211_mgmt *) skb->data;
667 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
669 + if (stype != IEEE80211_STYPE_BEACON)
672 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
673 + if (baselen > skb->len)
676 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
677 + skb->len - baselen, &elems);
679 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
683 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
687 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
695 + sta->last_rx = jiffies;
696 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
698 + if (elems.ht_cap_elem)
699 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
700 + elems.ht_cap_elem, &sta->sta.ht_cap);
702 + if (elems.wmm_param)
703 + set_sta_flag(sta, WLAN_STA_WME);
706 + set_sta_flag(sta, WLAN_STA_AUTHORIZED);
707 + rate_control_rate_init(sta);
708 + sta_info_insert_rcu(sta);
714 static void ieee80211_iface_work(struct work_struct *work)
716 struct ieee80211_sub_if_data *sdata =
717 @@ -949,6 +991,9 @@ static void ieee80211_iface_work(struct
719 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
721 + case NL80211_IFTYPE_WDS:
722 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
725 WARN(1, "frame for unexpected interface type");
727 --- a/net/mac80211/rx.c
728 +++ b/net/mac80211/rx.c
729 @@ -103,7 +103,7 @@ static void
730 ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
732 struct ieee80211_rate *rate,
734 + int rtap_len, bool has_fcs)
736 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
737 struct ieee80211_radiotap_header *rthdr;
738 @@ -134,7 +134,7 @@ ieee80211_add_rx_radiotap_header(struct
741 /* IEEE80211_RADIOTAP_FLAGS */
742 - if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
743 + if (has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS))
744 *pos |= IEEE80211_RADIOTAP_F_FCS;
745 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
746 *pos |= IEEE80211_RADIOTAP_F_BADFCS;
747 @@ -294,7 +294,8 @@ ieee80211_rx_monitor(struct ieee80211_lo
750 /* prepend radiotap information */
751 - ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom);
752 + ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom,
755 skb_reset_mac_header(skb);
756 skb->ip_summed = CHECKSUM_UNNECESSARY;
757 @@ -2282,6 +2283,7 @@ ieee80211_rx_h_action(struct ieee80211_r
758 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
759 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
760 sdata->vif.type != NL80211_IFTYPE_AP &&
761 + sdata->vif.type != NL80211_IFTYPE_WDS &&
762 sdata->vif.type != NL80211_IFTYPE_ADHOC)
765 @@ -2496,14 +2498,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
767 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
768 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
769 - sdata->vif.type != NL80211_IFTYPE_STATION)
770 + sdata->vif.type != NL80211_IFTYPE_STATION &&
771 + sdata->vif.type != NL80211_IFTYPE_WDS)
772 return RX_DROP_MONITOR;
775 case cpu_to_le16(IEEE80211_STYPE_AUTH):
776 case cpu_to_le16(IEEE80211_STYPE_BEACON):
777 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
778 - /* process for all: mesh, mlme, ibss */
779 + /* process for all: mesh, mlme, ibss, wds */
781 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
782 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
783 @@ -2567,7 +2570,8 @@ static void ieee80211_rx_cooked_monitor(
786 /* prepend radiotap information */
787 - ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom);
788 + ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom,
791 skb_set_mac_header(skb, 0);
792 skb->ip_summed = CHECKSUM_UNNECESSARY;
793 @@ -2836,10 +2840,16 @@ static int prepare_for_handlers(struct i
796 case NL80211_IFTYPE_WDS:
797 - if (bssid || !ieee80211_is_data(hdr->frame_control))
799 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
802 + if (ieee80211_is_data(hdr->frame_control) ||
803 + ieee80211_is_action(hdr->frame_control)) {
804 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
806 + } else if (!ieee80211_is_beacon(hdr->frame_control))
811 /* should never get here */
812 --- a/net/mac80211/sta_info.h
813 +++ b/net/mac80211/sta_info.h
815 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
817 * @WLAN_STA_WME: Station is a QoS-STA.
818 - * @WLAN_STA_WDS: Station is one of our WDS peers.
819 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
820 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
821 * frame to this station is transmitted.
822 @@ -64,7 +63,6 @@ enum ieee80211_sta_info_flags {
824 WLAN_STA_SHORT_PREAMBLE,
827 WLAN_STA_CLEAR_PS_FILT,
830 --- a/drivers/net/wireless/ath/ath9k/init.c
831 +++ b/drivers/net/wireless/ath/ath9k/init.c
832 @@ -647,6 +647,24 @@ void ath9k_reload_chainmask_settings(str
833 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
836 +static const struct ieee80211_iface_limit if_limits[] = {
837 + { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) |
838 + BIT(NL80211_IFTYPE_P2P_CLIENT) |
839 + BIT(NL80211_IFTYPE_WDS) },
840 + { .max = 8, .types =
841 +#ifdef CONFIG_MAC80211_MESH
842 + BIT(NL80211_IFTYPE_MESH_POINT) |
844 + BIT(NL80211_IFTYPE_AP) |
845 + BIT(NL80211_IFTYPE_P2P_GO) },
848 +static const struct ieee80211_iface_combination if_comb = {
849 + .limits = if_limits,
850 + .n_limits = ARRAY_SIZE(if_limits),
851 + .max_interfaces = 2048,
852 + .num_different_channels = 1,
855 void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
857 @@ -676,6 +694,9 @@ void ath9k_set_hw_capab(struct ath_softc
858 BIT(NL80211_IFTYPE_ADHOC) |
859 BIT(NL80211_IFTYPE_MESH_POINT);
861 + hw->wiphy->iface_combinations = &if_comb;
862 + hw->wiphy->n_iface_combinations = 1;
864 if (AR_SREV_5416(sc->sc_ah))
865 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
867 --- a/net/mac80211/ibss.c
868 +++ b/net/mac80211/ibss.c
869 @@ -455,8 +455,8 @@ static void ieee80211_rx_bss_info(struct
870 * fall back to HT20 if we don't use or use
871 * the other extension channel
873 - if ((channel_type == NL80211_CHAN_HT40MINUS ||
874 - channel_type == NL80211_CHAN_HT40PLUS) &&
875 + if (!(channel_type == NL80211_CHAN_HT40MINUS ||
876 + channel_type == NL80211_CHAN_HT40PLUS) ||
877 channel_type != sdata->u.ibss.channel_type)
878 sta_ht_cap_new.cap &=
879 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;