diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-09-02 13:30:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-09-02 13:30:07 -0400 |
commit | 78ab952717b62c0ba6ca7f7a27eaa0486685e45f (patch) | |
tree | a4ab2bfc578f279fc6847031f501d84c75057531 | |
parent | 3e502e63586920f219ed2590f69c1f5a8888cfa4 (diff) | |
parent | 85f72bc839705294b32b6c16b491c0422f0a71b3 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
124 files changed, 4513 insertions, 1866 deletions
diff --git a/Documentation/DocBook/80211.tmpl b/Documentation/DocBook/80211.tmpl index b84c9282828f..19a1210c2530 100644 --- a/Documentation/DocBook/80211.tmpl +++ b/Documentation/DocBook/80211.tmpl | |||
@@ -65,7 +65,6 @@ | |||
65 | </abstract> | 65 | </abstract> |
66 | </setinfo> | 66 | </setinfo> |
67 | <book id="cfg80211-developers-guide"> | 67 | <book id="cfg80211-developers-guide"> |
68 | !Ainclude/net/cfg80211.h | ||
69 | <bookinfo> | 68 | <bookinfo> |
70 | <title>The cfg80211 subsystem</title> | 69 | <title>The cfg80211 subsystem</title> |
71 | 70 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 93198c1980a9..7a49a7b5af1d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -4304,13 +4304,12 @@ F: Documentation/filesystems/dlmfs.txt | |||
4304 | F: fs/ocfs2/ | 4304 | F: fs/ocfs2/ |
4305 | 4305 | ||
4306 | ORINOCO DRIVER | 4306 | ORINOCO DRIVER |
4307 | M: Pavel Roskin <proski@gnu.org> | ||
4308 | M: David Gibson <hermes@gibson.dropbear.id.au> | ||
4309 | L: linux-wireless@vger.kernel.org | 4307 | L: linux-wireless@vger.kernel.org |
4310 | L: orinoco-users@lists.sourceforge.net | 4308 | L: orinoco-users@lists.sourceforge.net |
4311 | L: orinoco-devel@lists.sourceforge.net | 4309 | L: orinoco-devel@lists.sourceforge.net |
4310 | W: http://linuxwireless.org/en/users/Drivers/orinoco | ||
4312 | W: http://www.nongnu.org/orinoco/ | 4311 | W: http://www.nongnu.org/orinoco/ |
4313 | S: Maintained | 4312 | S: Orphan |
4314 | F: drivers/net/wireless/orinoco/ | 4313 | F: drivers/net/wireless/orinoco/ |
4315 | 4314 | ||
4316 | OSD LIBRARY and FILESYSTEM | 4315 | OSD LIBRARY and FILESYSTEM |
@@ -6376,7 +6375,7 @@ S: Maintained | |||
6376 | F: drivers/input/misc/wistron_btns.c | 6375 | F: drivers/input/misc/wistron_btns.c |
6377 | 6376 | ||
6378 | WL1251 WIRELESS DRIVER | 6377 | WL1251 WIRELESS DRIVER |
6379 | M: Kalle Valo <kalle.valo@iki.fi> | 6378 | M: Kalle Valo <kvalo@adurom.com> |
6380 | L: linux-wireless@vger.kernel.org | 6379 | L: linux-wireless@vger.kernel.org |
6381 | W: http://wireless.kernel.org | 6380 | W: http://wireless.kernel.org |
6382 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git | 6381 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git |
@@ -6391,6 +6390,7 @@ W: http://wireless.kernel.org | |||
6391 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git | 6390 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git |
6392 | S: Maintained | 6391 | S: Maintained |
6393 | F: drivers/net/wireless/wl12xx/wl1271* | 6392 | F: drivers/net/wireless/wl12xx/wl1271* |
6393 | F: include/linux/spi/wl12xx.h | ||
6394 | 6394 | ||
6395 | WL3501 WIRELESS PCMCIA CARD DRIVER | 6395 | WL3501 WIRELESS PCMCIA CARD DRIVER |
6396 | M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 6396 | M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> |
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index d32f2828b098..a706202fa67c 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -119,6 +119,7 @@ struct ath_common { | |||
119 | 119 | ||
120 | u32 keymax; | 120 | u32 keymax; |
121 | DECLARE_BITMAP(keymap, ATH_KEYMAX); | 121 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
122 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); | ||
122 | u8 splitmic; | 123 | u8 splitmic; |
123 | 124 | ||
124 | struct ath_regulatory regulatory; | 125 | struct ath_regulatory regulatory; |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index f2fceb10c9fc..45789c8990d3 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -700,10 +700,10 @@ ath5k_pci_probe(struct pci_dev *pdev, | |||
700 | return 0; | 700 | return 0; |
701 | err_ah: | 701 | err_ah: |
702 | ath5k_hw_detach(sc->ah); | 702 | ath5k_hw_detach(sc->ah); |
703 | err_irq: | ||
704 | free_irq(pdev->irq, sc); | ||
705 | err_free_ah: | 703 | err_free_ah: |
706 | kfree(sc->ah); | 704 | kfree(sc->ah); |
705 | err_irq: | ||
706 | free_irq(pdev->irq, sc); | ||
707 | err_free: | 707 | err_free: |
708 | ieee80211_free_hw(hw); | 708 | ieee80211_free_hw(hw); |
709 | err_map: | 709 | err_map: |
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 4cccc29964f6..1b7c6d7fde93 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -312,6 +312,7 @@ static const struct { | |||
312 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, | 312 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, |
313 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, | 313 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, |
314 | { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, | 314 | { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, |
315 | { ATH5K_DEBUG_DESC, "desc", "descriptor chains" }, | ||
315 | { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, | 316 | { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, |
316 | }; | 317 | }; |
317 | 318 | ||
@@ -955,7 +956,7 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah) | |||
955 | struct ath5k_rx_status rs = {}; | 956 | struct ath5k_rx_status rs = {}; |
956 | int status; | 957 | int status; |
957 | 958 | ||
958 | if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) | 959 | if (likely(!(sc->debug.level & ATH5K_DEBUG_DESC))) |
959 | return; | 960 | return; |
960 | 961 | ||
961 | printk(KERN_DEBUG "rxdp %x, rxlink %p\n", | 962 | printk(KERN_DEBUG "rxdp %x, rxlink %p\n", |
@@ -997,7 +998,7 @@ ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf) | |||
997 | struct ath5k_tx_status ts = {}; | 998 | struct ath5k_tx_status ts = {}; |
998 | int done; | 999 | int done; |
999 | 1000 | ||
1000 | if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) | 1001 | if (likely(!(sc->debug.level & ATH5K_DEBUG_DESC))) |
1001 | return; | 1002 | return; |
1002 | 1003 | ||
1003 | done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts); | 1004 | done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts); |
diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h index 606ae94a9157..9b22722a95f0 100644 --- a/drivers/net/wireless/ath/ath5k/debug.h +++ b/drivers/net/wireless/ath/ath5k/debug.h | |||
@@ -95,6 +95,7 @@ struct ath5k_dbg_info { | |||
95 | * @ATH5K_DEBUG_DUMP_TX: print transmit skb content | 95 | * @ATH5K_DEBUG_DUMP_TX: print transmit skb content |
96 | * @ATH5K_DEBUG_DUMPBANDS: dump bands | 96 | * @ATH5K_DEBUG_DUMPBANDS: dump bands |
97 | * @ATH5K_DEBUG_TRACE: trace function calls | 97 | * @ATH5K_DEBUG_TRACE: trace function calls |
98 | * @ATH5K_DEBUG_DESC: descriptor setup | ||
98 | * @ATH5K_DEBUG_ANY: show at any debug level | 99 | * @ATH5K_DEBUG_ANY: show at any debug level |
99 | * | 100 | * |
100 | * The debug level is used to control the amount and type of debugging output | 101 | * The debug level is used to control the amount and type of debugging output |
@@ -117,6 +118,7 @@ enum ath5k_debug_level { | |||
117 | ATH5K_DEBUG_DUMP_TX = 0x00000200, | 118 | ATH5K_DEBUG_DUMP_TX = 0x00000200, |
118 | ATH5K_DEBUG_DUMPBANDS = 0x00000400, | 119 | ATH5K_DEBUG_DUMPBANDS = 0x00000400, |
119 | ATH5K_DEBUG_ANI = 0x00002000, | 120 | ATH5K_DEBUG_ANI = 0x00002000, |
121 | ATH5K_DEBUG_DESC = 0x00004000, | ||
120 | ATH5K_DEBUG_ANY = 0xffffffff | 122 | ATH5K_DEBUG_ANY = 0xffffffff |
121 | }; | 123 | }; |
122 | 124 | ||
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c index 3fef5931ec3a..bb2e21553d1b 100644 --- a/drivers/net/wireless/ath/ath5k/pcu.c +++ b/drivers/net/wireless/ath/ath5k/pcu.c | |||
@@ -137,11 +137,11 @@ void ath5k_hw_update_mib_counters(struct ath5k_hw *ah) | |||
137 | * ath5k_hw_set_ack_bitrate - set bitrate for ACKs | 137 | * ath5k_hw_set_ack_bitrate - set bitrate for ACKs |
138 | * | 138 | * |
139 | * @ah: The &struct ath5k_hw | 139 | * @ah: The &struct ath5k_hw |
140 | * @high: Flag to determine if we want to use high transmition rate | 140 | * @high: Flag to determine if we want to use high transmission rate |
141 | * for ACKs or not | 141 | * for ACKs or not |
142 | * | 142 | * |
143 | * If high flag is set, we tell hw to use a set of control rates based on | 143 | * If high flag is set, we tell hw to use a set of control rates based on |
144 | * the current transmition rate (check out control_rates array inside reset.c). | 144 | * the current transmission rate (check out control_rates array inside reset.c). |
145 | * If not hw just uses the lowest rate available for the current modulation | 145 | * If not hw just uses the lowest rate available for the current modulation |
146 | * scheme being used (1Mbit for CCK and 6Mbits for OFDM). | 146 | * scheme being used (1Mbit for CCK and 6Mbits for OFDM). |
147 | */ | 147 | */ |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index c7c446592374..984ba92c7df3 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -1582,7 +1582,7 @@ ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah, | |||
1582 | else if (curr_sym_off >= 31 && curr_sym_off <= 46) | 1582 | else if (curr_sym_off >= 31 && curr_sym_off <= 46) |
1583 | mag_mask[2] |= | 1583 | mag_mask[2] |= |
1584 | plt_mag_map << (curr_sym_off - 31) * 2; | 1584 | plt_mag_map << (curr_sym_off - 31) * 2; |
1585 | else if (curr_sym_off >= 46 && curr_sym_off <= 53) | 1585 | else if (curr_sym_off >= 47 && curr_sym_off <= 53) |
1586 | mag_mask[3] |= | 1586 | mag_mask[3] |= |
1587 | plt_mag_map << (curr_sym_off - 47) * 2; | 1587 | plt_mag_map << (curr_sym_off - 47) * 2; |
1588 | 1588 | ||
@@ -2987,7 +2987,7 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, | |||
2987 | 2987 | ||
2988 | 2988 | ||
2989 | /* | 2989 | /* |
2990 | * Set transmition power | 2990 | * Set transmission power |
2991 | */ | 2991 | */ |
2992 | int | 2992 | int |
2993 | ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, | 2993 | ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, |
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index 4154959125b6..58912cd762d9 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -326,7 +326,7 @@ commit: | |||
326 | * register). After this MAC and Baseband are | 326 | * register). After this MAC and Baseband are |
327 | * disabled and a full reset is needed to come | 327 | * disabled and a full reset is needed to come |
328 | * back. This way we save as much power as possible | 328 | * back. This way we save as much power as possible |
329 | * without puting the card on full sleep. | 329 | * without putting the card on full sleep. |
330 | */ | 330 | */ |
331 | int ath5k_hw_on_hold(struct ath5k_hw *ah) | 331 | int ath5k_hw_on_hold(struct ath5k_hw *ah) |
332 | { | 332 | { |
@@ -344,7 +344,7 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah) | |||
344 | /* | 344 | /* |
345 | * Put chipset on warm reset... | 345 | * Put chipset on warm reset... |
346 | * | 346 | * |
347 | * Note: puting PCI core on warm reset on PCI-E cards | 347 | * Note: putting PCI core on warm reset on PCI-E cards |
348 | * results card to hang and always return 0xffff... so | 348 | * results card to hang and always return 0xffff... so |
349 | * we ingore that flag for PCI-E cards. On PCI cards | 349 | * we ingore that flag for PCI-E cards. On PCI cards |
350 | * this flag gets cleared after 64 PCI clocks. | 350 | * this flag gets cleared after 64 PCI clocks. |
@@ -400,7 +400,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
400 | /* | 400 | /* |
401 | * Put chipset on warm reset... | 401 | * Put chipset on warm reset... |
402 | * | 402 | * |
403 | * Note: puting PCI core on warm reset on PCI-E cards | 403 | * Note: putting PCI core on warm reset on PCI-E cards |
404 | * results card to hang and always return 0xffff... so | 404 | * results card to hang and always return 0xffff... so |
405 | * we ingore that flag for PCI-E cards. On PCI cards | 405 | * we ingore that flag for PCI-E cards. On PCI cards |
406 | * this flag gets cleared after 64 PCI clocks. | 406 | * this flag gets cleared after 64 PCI clocks. |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 31cfe468e3fc..2dab64bb23a8 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -372,9 +372,13 @@ int ath9k_cmn_key_config(struct ath_common *common, | |||
372 | set_bit(idx, common->keymap); | 372 | set_bit(idx, common->keymap); |
373 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { | 373 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { |
374 | set_bit(idx + 64, common->keymap); | 374 | set_bit(idx + 64, common->keymap); |
375 | set_bit(idx, common->tkip_keymap); | ||
376 | set_bit(idx + 64, common->tkip_keymap); | ||
375 | if (common->splitmic) { | 377 | if (common->splitmic) { |
376 | set_bit(idx + 32, common->keymap); | 378 | set_bit(idx + 32, common->keymap); |
377 | set_bit(idx + 64 + 32, common->keymap); | 379 | set_bit(idx + 64 + 32, common->keymap); |
380 | set_bit(idx + 32, common->tkip_keymap); | ||
381 | set_bit(idx + 64 + 32, common->tkip_keymap); | ||
378 | } | 382 | } |
379 | } | 383 | } |
380 | 384 | ||
@@ -399,10 +403,17 @@ void ath9k_cmn_key_delete(struct ath_common *common, | |||
399 | return; | 403 | return; |
400 | 404 | ||
401 | clear_bit(key->hw_key_idx + 64, common->keymap); | 405 | clear_bit(key->hw_key_idx + 64, common->keymap); |
406 | |||
407 | clear_bit(key->hw_key_idx, common->tkip_keymap); | ||
408 | clear_bit(key->hw_key_idx + 64, common->tkip_keymap); | ||
409 | |||
402 | if (common->splitmic) { | 410 | if (common->splitmic) { |
403 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); | 411 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); |
404 | clear_bit(key->hw_key_idx + 32, common->keymap); | 412 | clear_bit(key->hw_key_idx + 32, common->keymap); |
405 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); | 413 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); |
414 | |||
415 | clear_bit(key->hw_key_idx + 32, common->tkip_keymap); | ||
416 | clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap); | ||
406 | } | 417 | } |
407 | } | 418 | } |
408 | EXPORT_SYMBOL(ath9k_cmn_key_delete); | 419 | EXPORT_SYMBOL(ath9k_cmn_key_delete); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 5e318cb662c6..f4672073ac0a 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -1239,7 +1239,6 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) | |||
1239 | 1239 | ||
1240 | /* Cancel all the running timers/work .. */ | 1240 | /* Cancel all the running timers/work .. */ |
1241 | cancel_work_sync(&priv->ps_work); | 1241 | cancel_work_sync(&priv->ps_work); |
1242 | cancel_delayed_work_sync(&priv->ath9k_ani_work); | ||
1243 | cancel_delayed_work_sync(&priv->ath9k_led_blink_work); | 1242 | cancel_delayed_work_sync(&priv->ath9k_led_blink_work); |
1244 | ath9k_led_stop_brightness(priv); | 1243 | ath9k_led_stop_brightness(priv); |
1245 | 1244 | ||
@@ -1787,7 +1786,8 @@ static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw) | |||
1787 | priv->op_flags |= OP_SCANNING; | 1786 | priv->op_flags |= OP_SCANNING; |
1788 | spin_unlock_bh(&priv->beacon_lock); | 1787 | spin_unlock_bh(&priv->beacon_lock); |
1789 | cancel_work_sync(&priv->ps_work); | 1788 | cancel_work_sync(&priv->ps_work); |
1790 | cancel_delayed_work_sync(&priv->ath9k_ani_work); | 1789 | if (priv->op_flags & OP_ASSOCIATED) |
1790 | cancel_delayed_work_sync(&priv->ath9k_ani_work); | ||
1791 | mutex_unlock(&priv->mutex); | 1791 | mutex_unlock(&priv->mutex); |
1792 | } | 1792 | } |
1793 | 1793 | ||
@@ -1801,9 +1801,10 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw) | |||
1801 | priv->op_flags &= ~OP_SCANNING; | 1801 | priv->op_flags &= ~OP_SCANNING; |
1802 | spin_unlock_bh(&priv->beacon_lock); | 1802 | spin_unlock_bh(&priv->beacon_lock); |
1803 | priv->op_flags |= OP_FULL_RESET; | 1803 | priv->op_flags |= OP_FULL_RESET; |
1804 | if (priv->op_flags & OP_ASSOCIATED) | 1804 | if (priv->op_flags & OP_ASSOCIATED) { |
1805 | ath9k_htc_beacon_config(priv, priv->vif); | 1805 | ath9k_htc_beacon_config(priv, priv->vif); |
1806 | ath_start_ani(priv); | 1806 | ath_start_ani(priv); |
1807 | } | ||
1807 | ath9k_htc_ps_restore(priv); | 1808 | ath9k_htc_ps_restore(priv); |
1808 | mutex_unlock(&priv->mutex); | 1809 | mutex_unlock(&priv->mutex); |
1809 | } | 1810 | } |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 243c1775f343..3dbff8d07766 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -33,7 +33,7 @@ int modparam_nohwcrypt; | |||
33 | module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444); | 33 | module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444); |
34 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); | 34 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); |
35 | 35 | ||
36 | int led_blink = 1; | 36 | int led_blink; |
37 | module_param_named(blink, led_blink, int, 0444); | 37 | module_param_named(blink, led_blink, int, 0444); |
38 | MODULE_PARM_DESC(blink, "Enable LED blink on activity"); | 38 | MODULE_PARM_DESC(blink, "Enable LED blink on activity"); |
39 | 39 | ||
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index e955bb9d98cb..0b7d1253f0c0 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -711,7 +711,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | |||
711 | rs->rs_phyerr = phyerr; | 711 | rs->rs_phyerr = phyerr; |
712 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) | 712 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) |
713 | rs->rs_status |= ATH9K_RXERR_DECRYPT; | 713 | rs->rs_status |= ATH9K_RXERR_DECRYPT; |
714 | else if (ads.ds_rxstatus8 & AR_MichaelErr) | 714 | else if ((ads.ds_rxstatus8 & AR_MichaelErr) && |
715 | rs->rs_keyix != ATH9K_RXKEYIX_INVALID) | ||
715 | rs->rs_status |= ATH9K_RXERR_MIC; | 716 | rs->rs_status |= ATH9K_RXERR_MIC; |
716 | } | 717 | } |
717 | 718 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a3fc987ebab0..534a91bcc1d9 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -870,15 +870,18 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
870 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { | 870 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { |
871 | *decrypt_error = true; | 871 | *decrypt_error = true; |
872 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { | 872 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { |
873 | if (ieee80211_is_ctl(fc)) | 873 | /* |
874 | /* | 874 | * The MIC error bit is only valid if the frame |
875 | * Sometimes, we get invalid | 875 | * is not a control frame or fragment, and it was |
876 | * MIC failures on valid control frames. | 876 | * decrypted using a valid TKIP key. |
877 | * Remove these mic errors. | 877 | */ |
878 | */ | 878 | if (!ieee80211_is_ctl(fc) && |
879 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; | 879 | !ieee80211_has_morefrags(fc) && |
880 | else | 880 | !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && |
881 | test_bit(rx_stats->rs_keyix, common->tkip_keymap)) | ||
881 | rxs->flag |= RX_FLAG_MMIC_ERROR; | 882 | rxs->flag |= RX_FLAG_MMIC_ERROR; |
883 | else | ||
884 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; | ||
882 | } | 885 | } |
883 | /* | 886 | /* |
884 | * Reject error frames with the exception of | 887 | * Reject error frames with the exception of |
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index d116229c3347..2466c0a52e5d 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -3092,6 +3092,8 @@ static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask) | |||
3092 | struct b43_phy_n *nphy = phy->n; | 3092 | struct b43_phy_n *nphy = phy->n; |
3093 | u16 buf[16]; | 3093 | u16 buf[16]; |
3094 | 3094 | ||
3095 | nphy->phyrxchain = mask; | ||
3096 | |||
3095 | if (0 /* FIXME clk */) | 3097 | if (0 /* FIXME clk */) |
3096 | return; | 3098 | return; |
3097 | 3099 | ||
@@ -3103,7 +3105,7 @@ static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask) | |||
3103 | b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN, | 3105 | b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN, |
3104 | (mask & 0x3) << B43_NPHY_RFSEQCA_RXEN_SHIFT); | 3106 | (mask & 0x3) << B43_NPHY_RFSEQCA_RXEN_SHIFT); |
3105 | 3107 | ||
3106 | if (mask & 0x3 != 0x3) { | 3108 | if ((mask & 0x3) != 0x3) { |
3107 | b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 1); | 3109 | b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 1); |
3108 | if (dev->phy.rev >= 3) { | 3110 | if (dev->phy.rev >= 3) { |
3109 | /* TODO */ | 3111 | /* TODO */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 3bf5a30828be..674fb93ae17f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -130,7 +130,7 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv) | |||
130 | sizeof(struct iwlagn_scd_bc_tbl); | 130 | sizeof(struct iwlagn_scd_bc_tbl); |
131 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | 131 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); |
132 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; | 132 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; |
133 | priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID; | 133 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; |
134 | 134 | ||
135 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; | 135 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; |
136 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; | 136 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; |
@@ -217,7 +217,7 @@ static struct iwl_lib_ops iwl1000_lib = { | |||
217 | .set_ct_kill = iwl1000_set_ct_threshold, | 217 | .set_ct_kill = iwl1000_set_ct_threshold, |
218 | }, | 218 | }, |
219 | .manage_ibss_station = iwlagn_manage_ibss_station, | 219 | .manage_ibss_station = iwlagn_manage_ibss_station, |
220 | .update_bcast_station = iwl_update_bcast_station, | 220 | .update_bcast_stations = iwl_update_bcast_stations, |
221 | .debugfs_ops = { | 221 | .debugfs_ops = { |
222 | .rx_stats_read = iwl_ucode_rx_stats_read, | 222 | .rx_stats_read = iwl_ucode_rx_stats_read, |
223 | .tx_stats_read = iwl_ucode_tx_stats_read, | 223 | .tx_stats_read = iwl_ucode_tx_stats_read, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 7c731a793632..65b5834da28c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h | |||
@@ -62,7 +62,7 @@ | |||
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | /* | 63 | /* |
64 | * Please use this file (iwl-3945-hw.h) only for hardware-related definitions. | 64 | * Please use this file (iwl-3945-hw.h) only for hardware-related definitions. |
65 | * Please use iwl-3945-commands.h for uCode API definitions. | 65 | * Please use iwl-commands.h for uCode API definitions. |
66 | * Please use iwl-3945.h for driver implementation definitions. | 66 | * Please use iwl-3945.h for driver implementation definitions. |
67 | */ | 67 | */ |
68 | 68 | ||
@@ -226,6 +226,7 @@ struct iwl3945_eeprom { | |||
226 | 226 | ||
227 | /* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */ | 227 | /* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */ |
228 | #define IWL39_NUM_QUEUES 5 | 228 | #define IWL39_NUM_QUEUES 5 |
229 | #define IWL39_CMD_QUEUE_NUM 4 | ||
229 | 230 | ||
230 | #define IWL_DEFAULT_TX_RETRY 15 | 231 | #define IWL_DEFAULT_TX_RETRY 15 |
231 | 232 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 8e84a08ff951..d707f5bb1a8b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -343,7 +343,7 @@ void iwl3945_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 s | |||
343 | int i; | 343 | int i; |
344 | 344 | ||
345 | IWL_DEBUG_INFO(priv, "enter\n"); | 345 | IWL_DEBUG_INFO(priv, "enter\n"); |
346 | if (sta_id == priv->hw_params.bcast_sta_id) | 346 | if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) |
347 | goto out; | 347 | goto out; |
348 | 348 | ||
349 | psta = (struct iwl3945_sta_priv *) sta->drv_priv; | 349 | psta = (struct iwl3945_sta_priv *) sta->drv_priv; |
@@ -932,7 +932,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
932 | 932 | ||
933 | rcu_read_lock(); | 933 | rcu_read_lock(); |
934 | 934 | ||
935 | sta = ieee80211_find_sta(priv->vif, | 935 | sta = ieee80211_find_sta(priv->contexts[IWL_RXON_CTX_BSS].vif, |
936 | priv->stations[sta_id].sta.sta.addr); | 936 | priv->stations[sta_id].sta.sta.addr); |
937 | if (!sta) { | 937 | if (!sta) { |
938 | IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); | 938 | IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); |
@@ -949,7 +949,8 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
949 | switch (priv->band) { | 949 | switch (priv->band) { |
950 | case IEEE80211_BAND_2GHZ: | 950 | case IEEE80211_BAND_2GHZ: |
951 | /* TODO: this always does G, not a regression */ | 951 | /* TODO: this always does G, not a regression */ |
952 | if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { | 952 | if (priv->contexts[IWL_RXON_CTX_BSS].active.flags & |
953 | RXON_FLG_TGG_PROTECT_MSK) { | ||
953 | rs_sta->tgg = 1; | 954 | rs_sta->tgg = 1; |
954 | rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; | 955 | rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; |
955 | } else | 956 | } else |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 8ccfcd08218d..5d09686c3389 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -245,7 +245,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) | |||
245 | break; | 245 | break; |
246 | case IEEE80211_BAND_2GHZ: | 246 | case IEEE80211_BAND_2GHZ: |
247 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && | 247 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && |
248 | iwl_is_associated(priv)) { | 248 | iwl_is_associated(priv, IWL_RXON_CTX_BSS)) { |
249 | if (rate == IWL_RATE_11M_INDEX) | 249 | if (rate == IWL_RATE_11M_INDEX) |
250 | next_rate = IWL_RATE_5M_INDEX; | 250 | next_rate = IWL_RATE_5M_INDEX; |
251 | } | 251 | } |
@@ -273,7 +273,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, | |||
273 | struct iwl_queue *q = &txq->q; | 273 | struct iwl_queue *q = &txq->q; |
274 | struct iwl_tx_info *tx_info; | 274 | struct iwl_tx_info *tx_info; |
275 | 275 | ||
276 | BUG_ON(txq_id == IWL_CMD_QUEUE_NUM); | 276 | BUG_ON(txq_id == IWL39_CMD_QUEUE_NUM); |
277 | 277 | ||
278 | for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; | 278 | for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index; |
279 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 279 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
@@ -285,7 +285,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv, | |||
285 | } | 285 | } |
286 | 286 | ||
287 | if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && | 287 | if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) && |
288 | (txq_id != IWL_CMD_QUEUE_NUM) && | 288 | (txq_id != IWL39_CMD_QUEUE_NUM) && |
289 | priv->mac80211_registered) | 289 | priv->mac80211_registered) |
290 | iwl_wake_queue(priv, txq_id); | 290 | iwl_wake_queue(priv, txq_id); |
291 | } | 291 | } |
@@ -760,7 +760,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, | |||
760 | data_retry_limit = IWL_DEFAULT_TX_RETRY; | 760 | data_retry_limit = IWL_DEFAULT_TX_RETRY; |
761 | tx_cmd->data_retry_limit = data_retry_limit; | 761 | tx_cmd->data_retry_limit = data_retry_limit; |
762 | 762 | ||
763 | if (tx_id >= IWL_CMD_QUEUE_NUM) | 763 | if (tx_id >= IWL39_CMD_QUEUE_NUM) |
764 | rts_retry_limit = 3; | 764 | rts_retry_limit = 3; |
765 | else | 765 | else |
766 | rts_retry_limit = 7; | 766 | rts_retry_limit = 7; |
@@ -909,7 +909,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv) | |||
909 | 909 | ||
910 | /* Tx queue(s) */ | 910 | /* Tx queue(s) */ |
911 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 911 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { |
912 | slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? | 912 | slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? |
913 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 913 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
914 | rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, | 914 | rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, |
915 | txq_id); | 915 | txq_id); |
@@ -1072,7 +1072,7 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv) | |||
1072 | if (priv->txq) | 1072 | if (priv->txq) |
1073 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 1073 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
1074 | txq_id++) | 1074 | txq_id++) |
1075 | if (txq_id == IWL_CMD_QUEUE_NUM) | 1075 | if (txq_id == IWL39_CMD_QUEUE_NUM) |
1076 | iwl_cmd_queue_free(priv); | 1076 | iwl_cmd_queue_free(priv); |
1077 | else | 1077 | else |
1078 | iwl_tx_queue_free(priv, txq_id); | 1078 | iwl_tx_queue_free(priv, txq_id); |
@@ -1439,17 +1439,18 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv) | |||
1439 | int rate_idx, i; | 1439 | int rate_idx, i; |
1440 | const struct iwl_channel_info *ch_info = NULL; | 1440 | const struct iwl_channel_info *ch_info = NULL; |
1441 | struct iwl3945_txpowertable_cmd txpower = { | 1441 | struct iwl3945_txpowertable_cmd txpower = { |
1442 | .channel = priv->active_rxon.channel, | 1442 | .channel = priv->contexts[IWL_RXON_CTX_BSS].active.channel, |
1443 | }; | 1443 | }; |
1444 | u16 chan; | ||
1445 | |||
1446 | chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel); | ||
1444 | 1447 | ||
1445 | txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; | 1448 | txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; |
1446 | ch_info = iwl_get_channel_info(priv, | 1449 | ch_info = iwl_get_channel_info(priv, priv->band, chan); |
1447 | priv->band, | ||
1448 | le16_to_cpu(priv->active_rxon.channel)); | ||
1449 | if (!ch_info) { | 1450 | if (!ch_info) { |
1450 | IWL_ERR(priv, | 1451 | IWL_ERR(priv, |
1451 | "Failed to get channel info for channel %d [%d]\n", | 1452 | "Failed to get channel info for channel %d [%d]\n", |
1452 | le16_to_cpu(priv->active_rxon.channel), priv->band); | 1453 | chan, priv->band); |
1453 | return -EINVAL; | 1454 | return -EINVAL; |
1454 | } | 1455 | } |
1455 | 1456 | ||
@@ -1710,7 +1711,8 @@ int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) | |||
1710 | return 0; | 1711 | return 0; |
1711 | } | 1712 | } |
1712 | 1713 | ||
1713 | static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | 1714 | static int iwl3945_send_rxon_assoc(struct iwl_priv *priv, |
1715 | struct iwl_rxon_context *ctx) | ||
1714 | { | 1716 | { |
1715 | int rc = 0; | 1717 | int rc = 0; |
1716 | struct iwl_rx_packet *pkt; | 1718 | struct iwl_rx_packet *pkt; |
@@ -1721,8 +1723,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1721 | .flags = CMD_WANT_SKB, | 1723 | .flags = CMD_WANT_SKB, |
1722 | .data = &rxon_assoc, | 1724 | .data = &rxon_assoc, |
1723 | }; | 1725 | }; |
1724 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; | 1726 | const struct iwl_rxon_cmd *rxon1 = &ctx->staging; |
1725 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; | 1727 | const struct iwl_rxon_cmd *rxon2 = &ctx->active; |
1726 | 1728 | ||
1727 | if ((rxon1->flags == rxon2->flags) && | 1729 | if ((rxon1->flags == rxon2->flags) && |
1728 | (rxon1->filter_flags == rxon2->filter_flags) && | 1730 | (rxon1->filter_flags == rxon2->filter_flags) && |
@@ -1732,10 +1734,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1732 | return 0; | 1734 | return 0; |
1733 | } | 1735 | } |
1734 | 1736 | ||
1735 | rxon_assoc.flags = priv->staging_rxon.flags; | 1737 | rxon_assoc.flags = ctx->staging.flags; |
1736 | rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; | 1738 | rxon_assoc.filter_flags = ctx->staging.filter_flags; |
1737 | rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; | 1739 | rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; |
1738 | rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; | 1740 | rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; |
1739 | rxon_assoc.reserved = 0; | 1741 | rxon_assoc.reserved = 0; |
1740 | 1742 | ||
1741 | rc = iwl_send_cmd_sync(priv, &cmd); | 1743 | rc = iwl_send_cmd_sync(priv, &cmd); |
@@ -1761,14 +1763,14 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1761 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 1763 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
1762 | * a HW tune is required based on the RXON structure changes. | 1764 | * a HW tune is required based on the RXON structure changes. |
1763 | */ | 1765 | */ |
1764 | static int iwl3945_commit_rxon(struct iwl_priv *priv) | 1766 | static int iwl3945_commit_rxon(struct iwl_priv *priv, |
1767 | struct iwl_rxon_context *ctx) | ||
1765 | { | 1768 | { |
1766 | /* cast away the const for active_rxon in this function */ | 1769 | /* cast away the const for active_rxon in this function */ |
1767 | struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 1770 | struct iwl3945_rxon_cmd *active_rxon = (void *)&ctx->active; |
1768 | struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon; | 1771 | struct iwl3945_rxon_cmd *staging_rxon = (void *)&ctx->staging; |
1769 | int rc = 0; | 1772 | int rc = 0; |
1770 | bool new_assoc = | 1773 | bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); |
1771 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); | ||
1772 | 1774 | ||
1773 | if (!iwl_is_alive(priv)) | 1775 | if (!iwl_is_alive(priv)) |
1774 | return -1; | 1776 | return -1; |
@@ -1781,7 +1783,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1781 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); | 1783 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); |
1782 | staging_rxon->flags |= iwl3945_get_antenna_flags(priv); | 1784 | staging_rxon->flags |= iwl3945_get_antenna_flags(priv); |
1783 | 1785 | ||
1784 | rc = iwl_check_rxon_cmd(priv); | 1786 | rc = iwl_check_rxon_cmd(priv, ctx); |
1785 | if (rc) { | 1787 | if (rc) { |
1786 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | 1788 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); |
1787 | return -EINVAL; | 1789 | return -EINVAL; |
@@ -1790,8 +1792,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1790 | /* If we don't need to send a full RXON, we can use | 1792 | /* If we don't need to send a full RXON, we can use |
1791 | * iwl3945_rxon_assoc_cmd which is used to reconfigure filter | 1793 | * iwl3945_rxon_assoc_cmd which is used to reconfigure filter |
1792 | * and other flags for the current radio configuration. */ | 1794 | * and other flags for the current radio configuration. */ |
1793 | if (!iwl_full_rxon_required(priv)) { | 1795 | if (!iwl_full_rxon_required(priv, &priv->contexts[IWL_RXON_CTX_BSS])) { |
1794 | rc = iwl_send_rxon_assoc(priv); | 1796 | rc = iwl_send_rxon_assoc(priv, |
1797 | &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1795 | if (rc) { | 1798 | if (rc) { |
1796 | IWL_ERR(priv, "Error setting RXON_ASSOC " | 1799 | IWL_ERR(priv, "Error setting RXON_ASSOC " |
1797 | "configuration (%d).\n", rc); | 1800 | "configuration (%d).\n", rc); |
@@ -1807,7 +1810,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1807 | * an RXON_ASSOC and the new config wants the associated mask enabled, | 1810 | * an RXON_ASSOC and the new config wants the associated mask enabled, |
1808 | * we must clear the associated from the active configuration | 1811 | * we must clear the associated from the active configuration |
1809 | * before we apply the new config */ | 1812 | * before we apply the new config */ |
1810 | if (iwl_is_associated(priv) && new_assoc) { | 1813 | if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) { |
1811 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | 1814 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); |
1812 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1815 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1813 | 1816 | ||
@@ -1819,7 +1822,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1819 | active_rxon->reserved5 = 0; | 1822 | active_rxon->reserved5 = 0; |
1820 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | 1823 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
1821 | sizeof(struct iwl3945_rxon_cmd), | 1824 | sizeof(struct iwl3945_rxon_cmd), |
1822 | &priv->active_rxon); | 1825 | &priv->contexts[IWL_RXON_CTX_BSS].active); |
1823 | 1826 | ||
1824 | /* If the mask clearing failed then we set | 1827 | /* If the mask clearing failed then we set |
1825 | * active_rxon back to what it was previously */ | 1828 | * active_rxon back to what it was previously */ |
@@ -1829,8 +1832,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1829 | "configuration (%d).\n", rc); | 1832 | "configuration (%d).\n", rc); |
1830 | return rc; | 1833 | return rc; |
1831 | } | 1834 | } |
1832 | iwl_clear_ucode_stations(priv); | 1835 | iwl_clear_ucode_stations(priv, |
1833 | iwl_restore_stations(priv); | 1836 | &priv->contexts[IWL_RXON_CTX_BSS]); |
1837 | iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1834 | } | 1838 | } |
1835 | 1839 | ||
1836 | IWL_DEBUG_INFO(priv, "Sending RXON\n" | 1840 | IWL_DEBUG_INFO(priv, "Sending RXON\n" |
@@ -1848,7 +1852,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1848 | staging_rxon->reserved4 = 0; | 1852 | staging_rxon->reserved4 = 0; |
1849 | staging_rxon->reserved5 = 0; | 1853 | staging_rxon->reserved5 = 0; |
1850 | 1854 | ||
1851 | iwl_set_rxon_hwcrypto(priv, !iwl3945_mod_params.sw_crypto); | 1855 | iwl_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto); |
1852 | 1856 | ||
1853 | /* Apply the new configuration */ | 1857 | /* Apply the new configuration */ |
1854 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | 1858 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
@@ -1862,8 +1866,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) | |||
1862 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | 1866 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); |
1863 | 1867 | ||
1864 | if (!new_assoc) { | 1868 | if (!new_assoc) { |
1865 | iwl_clear_ucode_stations(priv); | 1869 | iwl_clear_ucode_stations(priv, |
1866 | iwl_restore_stations(priv); | 1870 | &priv->contexts[IWL_RXON_CTX_BSS]); |
1871 | iwl_restore_stations(priv, &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1867 | } | 1872 | } |
1868 | 1873 | ||
1869 | /* If we issue a new RXON command which required a tune then we must | 1874 | /* If we issue a new RXON command which required a tune then we must |
@@ -2302,8 +2307,10 @@ static int iwl3945_manage_ibss_station(struct iwl_priv *priv, | |||
2302 | int ret; | 2307 | int ret; |
2303 | 2308 | ||
2304 | if (add) { | 2309 | if (add) { |
2305 | ret = iwl_add_bssid_station(priv, vif->bss_conf.bssid, false, | 2310 | ret = iwl_add_bssid_station( |
2306 | &vif_priv->ibss_bssid_sta_id); | 2311 | priv, &priv->contexts[IWL_RXON_CTX_BSS], |
2312 | vif->bss_conf.bssid, false, | ||
2313 | &vif_priv->ibss_bssid_sta_id); | ||
2307 | if (ret) | 2314 | if (ret) |
2308 | return ret; | 2315 | return ret; |
2309 | 2316 | ||
@@ -2366,7 +2373,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) | |||
2366 | * 1M CCK rates */ | 2373 | * 1M CCK rates */ |
2367 | 2374 | ||
2368 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && | 2375 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && |
2369 | iwl_is_associated(priv)) { | 2376 | iwl_is_associated(priv, IWL_RXON_CTX_BSS)) { |
2370 | 2377 | ||
2371 | index = IWL_FIRST_CCK_RATE; | 2378 | index = IWL_FIRST_CCK_RATE; |
2372 | for (i = IWL_RATE_6M_INDEX_TABLE; | 2379 | for (i = IWL_RATE_6M_INDEX_TABLE; |
@@ -2421,7 +2428,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv) | |||
2421 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; | 2428 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; |
2422 | priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; | 2429 | priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; |
2423 | priv->hw_params.max_stations = IWL3945_STATION_COUNT; | 2430 | priv->hw_params.max_stations = IWL3945_STATION_COUNT; |
2424 | priv->hw_params.bcast_sta_id = IWL3945_BROADCAST_ID; | 2431 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; |
2432 | |||
2433 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | ||
2425 | 2434 | ||
2426 | priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; | 2435 | priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; |
2427 | priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; | 2436 | priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; |
@@ -2439,7 +2448,8 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
2439 | tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; | 2448 | tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; |
2440 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | 2449 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); |
2441 | 2450 | ||
2442 | tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; | 2451 | tx_beacon_cmd->tx.sta_id = |
2452 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; | ||
2443 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 2453 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
2444 | 2454 | ||
2445 | frame_size = iwl3945_fill_beacon_frame(priv, | 2455 | frame_size = iwl3945_fill_beacon_frame(priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f0a47f42d4b8..1d6a46d4db59 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -347,7 +347,7 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv) | |||
347 | struct iwl_chain_noise_data *data = &(priv->chain_noise_data); | 347 | struct iwl_chain_noise_data *data = &(priv->chain_noise_data); |
348 | 348 | ||
349 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && | 349 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && |
350 | iwl_is_associated(priv)) { | 350 | iwl_is_any_associated(priv)) { |
351 | struct iwl_calib_diff_gain_cmd cmd; | 351 | struct iwl_calib_diff_gain_cmd cmd; |
352 | 352 | ||
353 | /* clear data for chain noise calibration algorithm */ | 353 | /* clear data for chain noise calibration algorithm */ |
@@ -576,7 +576,7 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) | |||
576 | /* Activate all Tx DMA/FIFO channels */ | 576 | /* Activate all Tx DMA/FIFO channels */ |
577 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 6)); | 577 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 6)); |
578 | 578 | ||
579 | iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); | 579 | iwl4965_set_wr_ptrs(priv, IWL_DEFAULT_CMD_QUEUE_NUM, 0); |
580 | 580 | ||
581 | /* make sure all queue are not stopped */ | 581 | /* make sure all queue are not stopped */ |
582 | memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); | 582 | memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); |
@@ -587,6 +587,7 @@ static int iwl4965_alive_notify(struct iwl_priv *priv) | |||
587 | priv->txq_ctx_active_msk = 0; | 587 | priv->txq_ctx_active_msk = 0; |
588 | /* Map each Tx/cmd queue to its corresponding fifo */ | 588 | /* Map each Tx/cmd queue to its corresponding fifo */ |
589 | BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7); | 589 | BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7); |
590 | |||
590 | for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { | 591 | for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { |
591 | int ac = default_queue_to_tx_fifo[i]; | 592 | int ac = default_queue_to_tx_fifo[i]; |
592 | 593 | ||
@@ -656,7 +657,7 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) | |||
656 | sizeof(struct iwl4965_scd_bc_tbl); | 657 | sizeof(struct iwl4965_scd_bc_tbl); |
657 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | 658 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); |
658 | priv->hw_params.max_stations = IWL4965_STATION_COUNT; | 659 | priv->hw_params.max_stations = IWL4965_STATION_COUNT; |
659 | priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID; | 660 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; |
660 | priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; | 661 | priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; |
661 | priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; | 662 | priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; |
662 | priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; | 663 | priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; |
@@ -1374,6 +1375,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv) | |||
1374 | u8 band = 0; | 1375 | u8 band = 0; |
1375 | bool is_ht40 = false; | 1376 | bool is_ht40 = false; |
1376 | u8 ctrl_chan_high = 0; | 1377 | u8 ctrl_chan_high = 0; |
1378 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
1377 | 1379 | ||
1378 | if (test_bit(STATUS_SCANNING, &priv->status)) { | 1380 | if (test_bit(STATUS_SCANNING, &priv->status)) { |
1379 | /* If this gets hit a lot, switch it to a BUG() and catch | 1381 | /* If this gets hit a lot, switch it to a BUG() and catch |
@@ -1385,17 +1387,16 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv) | |||
1385 | 1387 | ||
1386 | band = priv->band == IEEE80211_BAND_2GHZ; | 1388 | band = priv->band == IEEE80211_BAND_2GHZ; |
1387 | 1389 | ||
1388 | is_ht40 = is_ht40_channel(priv->active_rxon.flags); | 1390 | is_ht40 = is_ht40_channel(ctx->active.flags); |
1389 | 1391 | ||
1390 | if (is_ht40 && | 1392 | if (is_ht40 && (ctx->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) |
1391 | (priv->active_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) | ||
1392 | ctrl_chan_high = 1; | 1393 | ctrl_chan_high = 1; |
1393 | 1394 | ||
1394 | cmd.band = band; | 1395 | cmd.band = band; |
1395 | cmd.channel = priv->active_rxon.channel; | 1396 | cmd.channel = ctx->active.channel; |
1396 | 1397 | ||
1397 | ret = iwl4965_fill_txpower_tbl(priv, band, | 1398 | ret = iwl4965_fill_txpower_tbl(priv, band, |
1398 | le16_to_cpu(priv->active_rxon.channel), | 1399 | le16_to_cpu(ctx->active.channel), |
1399 | is_ht40, ctrl_chan_high, &cmd.tx_power); | 1400 | is_ht40, ctrl_chan_high, &cmd.tx_power); |
1400 | if (ret) | 1401 | if (ret) |
1401 | goto out; | 1402 | goto out; |
@@ -1406,12 +1407,13 @@ out: | |||
1406 | return ret; | 1407 | return ret; |
1407 | } | 1408 | } |
1408 | 1409 | ||
1409 | static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | 1410 | static int iwl4965_send_rxon_assoc(struct iwl_priv *priv, |
1411 | struct iwl_rxon_context *ctx) | ||
1410 | { | 1412 | { |
1411 | int ret = 0; | 1413 | int ret = 0; |
1412 | struct iwl4965_rxon_assoc_cmd rxon_assoc; | 1414 | struct iwl4965_rxon_assoc_cmd rxon_assoc; |
1413 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; | 1415 | const struct iwl_rxon_cmd *rxon1 = &ctx->staging; |
1414 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; | 1416 | const struct iwl_rxon_cmd *rxon2 = &ctx->active; |
1415 | 1417 | ||
1416 | if ((rxon1->flags == rxon2->flags) && | 1418 | if ((rxon1->flags == rxon2->flags) && |
1417 | (rxon1->filter_flags == rxon2->filter_flags) && | 1419 | (rxon1->filter_flags == rxon2->filter_flags) && |
@@ -1426,16 +1428,16 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | |||
1426 | return 0; | 1428 | return 0; |
1427 | } | 1429 | } |
1428 | 1430 | ||
1429 | rxon_assoc.flags = priv->staging_rxon.flags; | 1431 | rxon_assoc.flags = ctx->staging.flags; |
1430 | rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; | 1432 | rxon_assoc.filter_flags = ctx->staging.filter_flags; |
1431 | rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; | 1433 | rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; |
1432 | rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; | 1434 | rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; |
1433 | rxon_assoc.reserved = 0; | 1435 | rxon_assoc.reserved = 0; |
1434 | rxon_assoc.ofdm_ht_single_stream_basic_rates = | 1436 | rxon_assoc.ofdm_ht_single_stream_basic_rates = |
1435 | priv->staging_rxon.ofdm_ht_single_stream_basic_rates; | 1437 | ctx->staging.ofdm_ht_single_stream_basic_rates; |
1436 | rxon_assoc.ofdm_ht_dual_stream_basic_rates = | 1438 | rxon_assoc.ofdm_ht_dual_stream_basic_rates = |
1437 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; | 1439 | ctx->staging.ofdm_ht_dual_stream_basic_rates; |
1438 | rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; | 1440 | rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; |
1439 | 1441 | ||
1440 | ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, | 1442 | ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, |
1441 | sizeof(rxon_assoc), &rxon_assoc, NULL); | 1443 | sizeof(rxon_assoc), &rxon_assoc, NULL); |
@@ -1448,6 +1450,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | |||
1448 | static int iwl4965_hw_channel_switch(struct iwl_priv *priv, | 1450 | static int iwl4965_hw_channel_switch(struct iwl_priv *priv, |
1449 | struct ieee80211_channel_switch *ch_switch) | 1451 | struct ieee80211_channel_switch *ch_switch) |
1450 | { | 1452 | { |
1453 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
1451 | int rc; | 1454 | int rc; |
1452 | u8 band = 0; | 1455 | u8 band = 0; |
1453 | bool is_ht40 = false; | 1456 | bool is_ht40 = false; |
@@ -1458,22 +1461,22 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, | |||
1458 | u16 ch; | 1461 | u16 ch; |
1459 | u32 tsf_low; | 1462 | u32 tsf_low; |
1460 | u8 switch_count; | 1463 | u8 switch_count; |
1461 | u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); | 1464 | u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); |
1462 | struct ieee80211_vif *vif = priv->vif; | 1465 | struct ieee80211_vif *vif = ctx->vif; |
1463 | band = priv->band == IEEE80211_BAND_2GHZ; | 1466 | band = priv->band == IEEE80211_BAND_2GHZ; |
1464 | 1467 | ||
1465 | is_ht40 = is_ht40_channel(priv->staging_rxon.flags); | 1468 | is_ht40 = is_ht40_channel(ctx->staging.flags); |
1466 | 1469 | ||
1467 | if (is_ht40 && | 1470 | if (is_ht40 && |
1468 | (priv->staging_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) | 1471 | (ctx->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) |
1469 | ctrl_chan_high = 1; | 1472 | ctrl_chan_high = 1; |
1470 | 1473 | ||
1471 | cmd.band = band; | 1474 | cmd.band = band; |
1472 | cmd.expect_beacon = 0; | 1475 | cmd.expect_beacon = 0; |
1473 | ch = ch_switch->channel->hw_value; | 1476 | ch = ch_switch->channel->hw_value; |
1474 | cmd.channel = cpu_to_le16(ch); | 1477 | cmd.channel = cpu_to_le16(ch); |
1475 | cmd.rxon_flags = priv->staging_rxon.flags; | 1478 | cmd.rxon_flags = ctx->staging.flags; |
1476 | cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; | 1479 | cmd.rxon_filter_flags = ctx->staging.filter_flags; |
1477 | switch_count = ch_switch->count; | 1480 | switch_count = ch_switch->count; |
1478 | tsf_low = ch_switch->timestamp & 0x0ffffffff; | 1481 | tsf_low = ch_switch->timestamp & 0x0ffffffff; |
1479 | /* | 1482 | /* |
@@ -1508,7 +1511,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, | |||
1508 | cmd.expect_beacon = is_channel_radar(ch_info); | 1511 | cmd.expect_beacon = is_channel_radar(ch_info); |
1509 | else { | 1512 | else { |
1510 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", | 1513 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", |
1511 | priv->active_rxon.channel, ch); | 1514 | ctx->active.channel, ch); |
1512 | return -EFAULT; | 1515 | return -EFAULT; |
1513 | } | 1516 | } |
1514 | 1517 | ||
@@ -2007,7 +2010,7 @@ static u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | |||
2007 | start = IWL_STA_ID; | 2010 | start = IWL_STA_ID; |
2008 | 2011 | ||
2009 | if (is_broadcast_ether_addr(addr)) | 2012 | if (is_broadcast_ether_addr(addr)) |
2010 | return priv->hw_params.bcast_sta_id; | 2013 | return priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; |
2011 | 2014 | ||
2012 | spin_lock_irqsave(&priv->sta_lock, flags); | 2015 | spin_lock_irqsave(&priv->sta_lock, flags); |
2013 | for (i = start; i < priv->hw_params.max_stations; i++) | 2016 | for (i = start; i < priv->hw_params.max_stations; i++) |
@@ -2280,7 +2283,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2280 | .set_ct_kill = iwl4965_set_ct_threshold, | 2283 | .set_ct_kill = iwl4965_set_ct_threshold, |
2281 | }, | 2284 | }, |
2282 | .manage_ibss_station = iwlagn_manage_ibss_station, | 2285 | .manage_ibss_station = iwlagn_manage_ibss_station, |
2283 | .update_bcast_station = iwl_update_bcast_station, | 2286 | .update_bcast_stations = iwl_update_bcast_stations, |
2284 | .debugfs_ops = { | 2287 | .debugfs_ops = { |
2285 | .rx_stats_read = iwl_ucode_rx_stats_read, | 2288 | .rx_stats_read = iwl_ucode_rx_stats_read, |
2286 | .tx_stats_read = iwl_ucode_tx_stats_read, | 2289 | .tx_stats_read = iwl_ucode_tx_stats_read, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 146e6431ae95..3975e45e7500 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -62,7 +62,7 @@ | |||
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | /* | 63 | /* |
64 | * Please use this file (iwl-5000-hw.h) only for hardware-related definitions. | 64 | * Please use this file (iwl-5000-hw.h) only for hardware-related definitions. |
65 | * Use iwl-5000-commands.h for uCode API definitions. | 65 | * Use iwl-commands.h for uCode API definitions. |
66 | */ | 66 | */ |
67 | 67 | ||
68 | #ifndef __iwl_5000_hw_h__ | 68 | #ifndef __iwl_5000_hw_h__ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 013f3dae69f1..1dbb1246c083 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -180,7 +180,7 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) | |||
180 | sizeof(struct iwlagn_scd_bc_tbl); | 180 | sizeof(struct iwlagn_scd_bc_tbl); |
181 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | 181 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); |
182 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; | 182 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; |
183 | priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID; | 183 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; |
184 | 184 | ||
185 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; | 185 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; |
186 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; | 186 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; |
@@ -227,7 +227,7 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv) | |||
227 | sizeof(struct iwlagn_scd_bc_tbl); | 227 | sizeof(struct iwlagn_scd_bc_tbl); |
228 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | 228 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); |
229 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; | 229 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; |
230 | priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID; | 230 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; |
231 | 231 | ||
232 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; | 232 | priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; |
233 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; | 233 | priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; |
@@ -275,14 +275,19 @@ static void iwl5150_temperature(struct iwl_priv *priv) | |||
275 | static int iwl5000_hw_channel_switch(struct iwl_priv *priv, | 275 | static int iwl5000_hw_channel_switch(struct iwl_priv *priv, |
276 | struct ieee80211_channel_switch *ch_switch) | 276 | struct ieee80211_channel_switch *ch_switch) |
277 | { | 277 | { |
278 | /* | ||
279 | * MULTI-FIXME | ||
280 | * See iwl_mac_channel_switch. | ||
281 | */ | ||
282 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
278 | struct iwl5000_channel_switch_cmd cmd; | 283 | struct iwl5000_channel_switch_cmd cmd; |
279 | const struct iwl_channel_info *ch_info; | 284 | const struct iwl_channel_info *ch_info; |
280 | u32 switch_time_in_usec, ucode_switch_time; | 285 | u32 switch_time_in_usec, ucode_switch_time; |
281 | u16 ch; | 286 | u16 ch; |
282 | u32 tsf_low; | 287 | u32 tsf_low; |
283 | u8 switch_count; | 288 | u8 switch_count; |
284 | u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); | 289 | u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); |
285 | struct ieee80211_vif *vif = priv->vif; | 290 | struct ieee80211_vif *vif = ctx->vif; |
286 | struct iwl_host_cmd hcmd = { | 291 | struct iwl_host_cmd hcmd = { |
287 | .id = REPLY_CHANNEL_SWITCH, | 292 | .id = REPLY_CHANNEL_SWITCH, |
288 | .len = sizeof(cmd), | 293 | .len = sizeof(cmd), |
@@ -293,10 +298,10 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, | |||
293 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; | 298 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; |
294 | ch = ch_switch->channel->hw_value; | 299 | ch = ch_switch->channel->hw_value; |
295 | IWL_DEBUG_11H(priv, "channel switch from %d to %d\n", | 300 | IWL_DEBUG_11H(priv, "channel switch from %d to %d\n", |
296 | priv->active_rxon.channel, ch); | 301 | ctx->active.channel, ch); |
297 | cmd.channel = cpu_to_le16(ch); | 302 | cmd.channel = cpu_to_le16(ch); |
298 | cmd.rxon_flags = priv->staging_rxon.flags; | 303 | cmd.rxon_flags = ctx->staging.flags; |
299 | cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; | 304 | cmd.rxon_filter_flags = ctx->staging.filter_flags; |
300 | switch_count = ch_switch->count; | 305 | switch_count = ch_switch->count; |
301 | tsf_low = ch_switch->timestamp & 0x0ffffffff; | 306 | tsf_low = ch_switch->timestamp & 0x0ffffffff; |
302 | /* | 307 | /* |
@@ -331,7 +336,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, | |||
331 | cmd.expect_beacon = is_channel_radar(ch_info); | 336 | cmd.expect_beacon = is_channel_radar(ch_info); |
332 | else { | 337 | else { |
333 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", | 338 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", |
334 | priv->active_rxon.channel, ch); | 339 | ctx->active.channel, ch); |
335 | return -EFAULT; | 340 | return -EFAULT; |
336 | } | 341 | } |
337 | priv->switch_rxon.channel = cmd.channel; | 342 | priv->switch_rxon.channel = cmd.channel; |
@@ -393,7 +398,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
393 | .set_ct_kill = iwl5000_set_ct_threshold, | 398 | .set_ct_kill = iwl5000_set_ct_threshold, |
394 | }, | 399 | }, |
395 | .manage_ibss_station = iwlagn_manage_ibss_station, | 400 | .manage_ibss_station = iwlagn_manage_ibss_station, |
396 | .update_bcast_station = iwl_update_bcast_station, | 401 | .update_bcast_stations = iwl_update_bcast_stations, |
397 | .debugfs_ops = { | 402 | .debugfs_ops = { |
398 | .rx_stats_read = iwl_ucode_rx_stats_read, | 403 | .rx_stats_read = iwl_ucode_rx_stats_read, |
399 | .tx_stats_read = iwl_ucode_tx_stats_read, | 404 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -464,7 +469,7 @@ static struct iwl_lib_ops iwl5150_lib = { | |||
464 | .set_ct_kill = iwl5150_set_ct_threshold, | 469 | .set_ct_kill = iwl5150_set_ct_threshold, |
465 | }, | 470 | }, |
466 | .manage_ibss_station = iwlagn_manage_ibss_station, | 471 | .manage_ibss_station = iwlagn_manage_ibss_station, |
467 | .update_bcast_station = iwl_update_bcast_station, | 472 | .update_bcast_stations = iwl_update_bcast_stations, |
468 | .debugfs_ops = { | 473 | .debugfs_ops = { |
469 | .rx_stats_read = iwl_ucode_rx_stats_read, | 474 | .rx_stats_read = iwl_ucode_rx_stats_read, |
470 | .tx_stats_read = iwl_ucode_tx_stats_read, | 475 | .tx_stats_read = iwl_ucode_tx_stats_read, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000-hw.h b/drivers/net/wireless/iwlwifi/iwl-6000-hw.h index ddba39999997..47891e16a758 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-6000-hw.h | |||
@@ -62,7 +62,7 @@ | |||
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | /* | 63 | /* |
64 | * Please use this file (iwl-6000-hw.h) only for hardware-related definitions. | 64 | * Please use this file (iwl-6000-hw.h) only for hardware-related definitions. |
65 | * Use iwl-5000-commands.h for uCode API definitions. | 65 | * Use iwl-commands.h for uCode API definitions. |
66 | */ | 66 | */ |
67 | 67 | ||
68 | #ifndef __iwl_6000_hw_h__ | 68 | #ifndef __iwl_6000_hw_h__ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 9e390f698641..2fdba088bd27 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -52,7 +52,7 @@ | |||
52 | /* Highest firmware API version supported */ | 52 | /* Highest firmware API version supported */ |
53 | #define IWL6000_UCODE_API_MAX 4 | 53 | #define IWL6000_UCODE_API_MAX 4 |
54 | #define IWL6050_UCODE_API_MAX 4 | 54 | #define IWL6050_UCODE_API_MAX 4 |
55 | #define IWL6000G2_UCODE_API_MAX 4 | 55 | #define IWL6000G2_UCODE_API_MAX 5 |
56 | 56 | ||
57 | /* Lowest firmware API version supported */ | 57 | /* Lowest firmware API version supported */ |
58 | #define IWL6000_UCODE_API_MIN 4 | 58 | #define IWL6000_UCODE_API_MIN 4 |
@@ -161,7 +161,7 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) | |||
161 | sizeof(struct iwlagn_scd_bc_tbl); | 161 | sizeof(struct iwlagn_scd_bc_tbl); |
162 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); | 162 | priv->hw_params.tfd_size = sizeof(struct iwl_tfd); |
163 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; | 163 | priv->hw_params.max_stations = IWLAGN_STATION_COUNT; |
164 | priv->hw_params.bcast_sta_id = IWLAGN_BROADCAST_ID; | 164 | priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; |
165 | 165 | ||
166 | priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; | 166 | priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; |
167 | priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; | 167 | priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; |
@@ -198,14 +198,19 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) | |||
198 | static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | 198 | static int iwl6000_hw_channel_switch(struct iwl_priv *priv, |
199 | struct ieee80211_channel_switch *ch_switch) | 199 | struct ieee80211_channel_switch *ch_switch) |
200 | { | 200 | { |
201 | /* | ||
202 | * MULTI-FIXME | ||
203 | * See iwl_mac_channel_switch. | ||
204 | */ | ||
205 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
201 | struct iwl6000_channel_switch_cmd cmd; | 206 | struct iwl6000_channel_switch_cmd cmd; |
202 | const struct iwl_channel_info *ch_info; | 207 | const struct iwl_channel_info *ch_info; |
203 | u32 switch_time_in_usec, ucode_switch_time; | 208 | u32 switch_time_in_usec, ucode_switch_time; |
204 | u16 ch; | 209 | u16 ch; |
205 | u32 tsf_low; | 210 | u32 tsf_low; |
206 | u8 switch_count; | 211 | u8 switch_count; |
207 | u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); | 212 | u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); |
208 | struct ieee80211_vif *vif = priv->vif; | 213 | struct ieee80211_vif *vif = ctx->vif; |
209 | struct iwl_host_cmd hcmd = { | 214 | struct iwl_host_cmd hcmd = { |
210 | .id = REPLY_CHANNEL_SWITCH, | 215 | .id = REPLY_CHANNEL_SWITCH, |
211 | .len = sizeof(cmd), | 216 | .len = sizeof(cmd), |
@@ -216,10 +221,10 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
216 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; | 221 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; |
217 | ch = ch_switch->channel->hw_value; | 222 | ch = ch_switch->channel->hw_value; |
218 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", | 223 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", |
219 | priv->active_rxon.channel, ch); | 224 | ctx->active.channel, ch); |
220 | cmd.channel = cpu_to_le16(ch); | 225 | cmd.channel = cpu_to_le16(ch); |
221 | cmd.rxon_flags = priv->staging_rxon.flags; | 226 | cmd.rxon_flags = ctx->staging.flags; |
222 | cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; | 227 | cmd.rxon_filter_flags = ctx->staging.filter_flags; |
223 | switch_count = ch_switch->count; | 228 | switch_count = ch_switch->count; |
224 | tsf_low = ch_switch->timestamp & 0x0ffffffff; | 229 | tsf_low = ch_switch->timestamp & 0x0ffffffff; |
225 | /* | 230 | /* |
@@ -254,7 +259,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
254 | cmd.expect_beacon = is_channel_radar(ch_info); | 259 | cmd.expect_beacon = is_channel_radar(ch_info); |
255 | else { | 260 | else { |
256 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", | 261 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", |
257 | priv->active_rxon.channel, ch); | 262 | ctx->active.channel, ch); |
258 | return -EFAULT; | 263 | return -EFAULT; |
259 | } | 264 | } |
260 | priv->switch_rxon.channel = cmd.channel; | 265 | priv->switch_rxon.channel = cmd.channel; |
@@ -318,7 +323,82 @@ static struct iwl_lib_ops iwl6000_lib = { | |||
318 | .set_calib_version = iwl6000_set_calib_version, | 323 | .set_calib_version = iwl6000_set_calib_version, |
319 | }, | 324 | }, |
320 | .manage_ibss_station = iwlagn_manage_ibss_station, | 325 | .manage_ibss_station = iwlagn_manage_ibss_station, |
321 | .update_bcast_station = iwl_update_bcast_station, | 326 | .update_bcast_stations = iwl_update_bcast_stations, |
327 | .debugfs_ops = { | ||
328 | .rx_stats_read = iwl_ucode_rx_stats_read, | ||
329 | .tx_stats_read = iwl_ucode_tx_stats_read, | ||
330 | .general_stats_read = iwl_ucode_general_stats_read, | ||
331 | .bt_stats_read = iwl_ucode_bt_stats_read, | ||
332 | }, | ||
333 | .recover_from_tx_stall = iwl_bg_monitor_recover, | ||
334 | .check_plcp_health = iwl_good_plcp_health, | ||
335 | .check_ack_health = iwl_good_ack_health, | ||
336 | .txfifo_flush = iwlagn_txfifo_flush, | ||
337 | .dev_txfifo_flush = iwlagn_dev_txfifo_flush, | ||
338 | .tt_ops = { | ||
339 | .lower_power_detection = iwl_tt_is_low_power_state, | ||
340 | .tt_power_mode = iwl_tt_current_power_mode, | ||
341 | .ct_kill_check = iwl_check_for_ct_kill, | ||
342 | } | ||
343 | }; | ||
344 | |||
345 | static struct iwl_lib_ops iwl6000g2b_lib = { | ||
346 | .set_hw_params = iwl6000_hw_set_hw_params, | ||
347 | .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, | ||
348 | .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, | ||
349 | .txq_set_sched = iwlagn_txq_set_sched, | ||
350 | .txq_agg_enable = iwlagn_txq_agg_enable, | ||
351 | .txq_agg_disable = iwlagn_txq_agg_disable, | ||
352 | .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd, | ||
353 | .txq_free_tfd = iwl_hw_txq_free_tfd, | ||
354 | .txq_init = iwl_hw_tx_queue_init, | ||
355 | .rx_handler_setup = iwlagn_bt_rx_handler_setup, | ||
356 | .setup_deferred_work = iwlagn_bt_setup_deferred_work, | ||
357 | .cancel_deferred_work = iwlagn_bt_cancel_deferred_work, | ||
358 | .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, | ||
359 | .load_ucode = iwlagn_load_ucode, | ||
360 | .dump_nic_event_log = iwl_dump_nic_event_log, | ||
361 | .dump_nic_error_log = iwl_dump_nic_error_log, | ||
362 | .dump_csr = iwl_dump_csr, | ||
363 | .dump_fh = iwl_dump_fh, | ||
364 | .init_alive_start = iwlagn_init_alive_start, | ||
365 | .alive_notify = iwlagn_alive_notify, | ||
366 | .send_tx_power = iwlagn_send_tx_power, | ||
367 | .update_chain_flags = iwl_update_chain_flags, | ||
368 | .set_channel_switch = iwl6000_hw_channel_switch, | ||
369 | .apm_ops = { | ||
370 | .init = iwl_apm_init, | ||
371 | .stop = iwl_apm_stop, | ||
372 | .config = iwl6000_nic_config, | ||
373 | .set_pwr_src = iwl_set_pwr_src, | ||
374 | }, | ||
375 | .eeprom_ops = { | ||
376 | .regulatory_bands = { | ||
377 | EEPROM_REG_BAND_1_CHANNELS, | ||
378 | EEPROM_REG_BAND_2_CHANNELS, | ||
379 | EEPROM_REG_BAND_3_CHANNELS, | ||
380 | EEPROM_REG_BAND_4_CHANNELS, | ||
381 | EEPROM_REG_BAND_5_CHANNELS, | ||
382 | EEPROM_6000_REG_BAND_24_HT40_CHANNELS, | ||
383 | EEPROM_REG_BAND_52_HT40_CHANNELS | ||
384 | }, | ||
385 | .verify_signature = iwlcore_eeprom_verify_signature, | ||
386 | .acquire_semaphore = iwlcore_eeprom_acquire_semaphore, | ||
387 | .release_semaphore = iwlcore_eeprom_release_semaphore, | ||
388 | .calib_version = iwlagn_eeprom_calib_version, | ||
389 | .query_addr = iwlagn_eeprom_query_addr, | ||
390 | .update_enhanced_txpower = iwlcore_eeprom_enhanced_txpower, | ||
391 | }, | ||
392 | .post_associate = iwl_post_associate, | ||
393 | .isr = iwl_isr_ict, | ||
394 | .config_ap = iwl_config_ap, | ||
395 | .temp_ops = { | ||
396 | .temperature = iwlagn_temperature, | ||
397 | .set_ct_kill = iwl6000_set_ct_threshold, | ||
398 | .set_calib_version = iwl6000_set_calib_version, | ||
399 | }, | ||
400 | .manage_ibss_station = iwlagn_manage_ibss_station, | ||
401 | .update_bcast_stations = iwl_update_bcast_stations, | ||
322 | .debugfs_ops = { | 402 | .debugfs_ops = { |
323 | .rx_stats_read = iwl_ucode_rx_stats_read, | 403 | .rx_stats_read = iwl_ucode_rx_stats_read, |
324 | .tx_stats_read = iwl_ucode_tx_stats_read, | 404 | .tx_stats_read = iwl_ucode_tx_stats_read, |
@@ -344,21 +424,9 @@ static const struct iwl_ops iwl6000_ops = { | |||
344 | .led = &iwlagn_led_ops, | 424 | .led = &iwlagn_led_ops, |
345 | }; | 425 | }; |
346 | 426 | ||
347 | static void do_not_send_bt_config(struct iwl_priv *priv) | ||
348 | { | ||
349 | } | ||
350 | |||
351 | static struct iwl_hcmd_ops iwl6000g2b_hcmd = { | ||
352 | .rxon_assoc = iwlagn_send_rxon_assoc, | ||
353 | .commit_rxon = iwl_commit_rxon, | ||
354 | .set_rxon_chain = iwl_set_rxon_chain, | ||
355 | .set_tx_ant = iwlagn_send_tx_ant_config, | ||
356 | .send_bt_config = do_not_send_bt_config, | ||
357 | }; | ||
358 | |||
359 | static const struct iwl_ops iwl6000g2b_ops = { | 427 | static const struct iwl_ops iwl6000g2b_ops = { |
360 | .lib = &iwl6000_lib, | 428 | .lib = &iwl6000g2b_lib, |
361 | .hcmd = &iwl6000g2b_hcmd, | 429 | .hcmd = &iwlagn_bt_hcmd, |
362 | .utils = &iwlagn_hcmd_utils, | 430 | .utils = &iwlagn_hcmd_utils, |
363 | .led = &iwlagn_led_ops, | 431 | .led = &iwlagn_led_ops, |
364 | }; | 432 | }; |
@@ -499,7 +567,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { | |||
499 | .supports_idle = true, | 567 | .supports_idle = true, |
500 | .adv_thermal_throttle = true, | 568 | .adv_thermal_throttle = true, |
501 | .support_ct_kill_exit = true, | 569 | .support_ct_kill_exit = true, |
502 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 570 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE, |
503 | .chain_noise_scale = 1000, | 571 | .chain_noise_scale = 1000, |
504 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, | 572 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
505 | .max_event_log_size = 512, | 573 | .max_event_log_size = 512, |
@@ -507,6 +575,11 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { | |||
507 | .chain_noise_calib_by_driver = true, | 575 | .chain_noise_calib_by_driver = true, |
508 | .need_dc_calib = true, | 576 | .need_dc_calib = true, |
509 | .bt_statistics = true, | 577 | .bt_statistics = true, |
578 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | ||
579 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | ||
580 | .advanced_bt_coexist = true, | ||
581 | .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, | ||
582 | .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, | ||
510 | }; | 583 | }; |
511 | 584 | ||
512 | struct iwl_cfg iwl6000g2b_2abg_cfg = { | 585 | struct iwl_cfg iwl6000g2b_2abg_cfg = { |
@@ -535,7 +608,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { | |||
535 | .supports_idle = true, | 608 | .supports_idle = true, |
536 | .adv_thermal_throttle = true, | 609 | .adv_thermal_throttle = true, |
537 | .support_ct_kill_exit = true, | 610 | .support_ct_kill_exit = true, |
538 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 611 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE, |
539 | .chain_noise_scale = 1000, | 612 | .chain_noise_scale = 1000, |
540 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, | 613 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
541 | .max_event_log_size = 512, | 614 | .max_event_log_size = 512, |
@@ -543,6 +616,11 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { | |||
543 | .chain_noise_calib_by_driver = true, | 616 | .chain_noise_calib_by_driver = true, |
544 | .need_dc_calib = true, | 617 | .need_dc_calib = true, |
545 | .bt_statistics = true, | 618 | .bt_statistics = true, |
619 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | ||
620 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | ||
621 | .advanced_bt_coexist = true, | ||
622 | .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, | ||
623 | .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, | ||
546 | }; | 624 | }; |
547 | 625 | ||
548 | struct iwl_cfg iwl6000g2b_2bgn_cfg = { | 626 | struct iwl_cfg iwl6000g2b_2bgn_cfg = { |
@@ -573,7 +651,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { | |||
573 | .supports_idle = true, | 651 | .supports_idle = true, |
574 | .adv_thermal_throttle = true, | 652 | .adv_thermal_throttle = true, |
575 | .support_ct_kill_exit = true, | 653 | .support_ct_kill_exit = true, |
576 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 654 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE, |
577 | .chain_noise_scale = 1000, | 655 | .chain_noise_scale = 1000, |
578 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, | 656 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
579 | .max_event_log_size = 512, | 657 | .max_event_log_size = 512, |
@@ -581,6 +659,11 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { | |||
581 | .chain_noise_calib_by_driver = true, | 659 | .chain_noise_calib_by_driver = true, |
582 | .need_dc_calib = true, | 660 | .need_dc_calib = true, |
583 | .bt_statistics = true, | 661 | .bt_statistics = true, |
662 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | ||
663 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | ||
664 | .advanced_bt_coexist = true, | ||
665 | .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, | ||
666 | .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, | ||
584 | }; | 667 | }; |
585 | 668 | ||
586 | struct iwl_cfg iwl6000g2b_2bg_cfg = { | 669 | struct iwl_cfg iwl6000g2b_2bg_cfg = { |
@@ -609,7 +692,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { | |||
609 | .supports_idle = true, | 692 | .supports_idle = true, |
610 | .adv_thermal_throttle = true, | 693 | .adv_thermal_throttle = true, |
611 | .support_ct_kill_exit = true, | 694 | .support_ct_kill_exit = true, |
612 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 695 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE, |
613 | .chain_noise_scale = 1000, | 696 | .chain_noise_scale = 1000, |
614 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, | 697 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
615 | .max_event_log_size = 512, | 698 | .max_event_log_size = 512, |
@@ -617,6 +700,11 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { | |||
617 | .chain_noise_calib_by_driver = true, | 700 | .chain_noise_calib_by_driver = true, |
618 | .need_dc_calib = true, | 701 | .need_dc_calib = true, |
619 | .bt_statistics = true, | 702 | .bt_statistics = true, |
703 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | ||
704 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | ||
705 | .advanced_bt_coexist = true, | ||
706 | .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, | ||
707 | .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, | ||
620 | }; | 708 | }; |
621 | 709 | ||
622 | struct iwl_cfg iwl6000g2b_bgn_cfg = { | 710 | struct iwl_cfg iwl6000g2b_bgn_cfg = { |
@@ -647,7 +735,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { | |||
647 | .supports_idle = true, | 735 | .supports_idle = true, |
648 | .adv_thermal_throttle = true, | 736 | .adv_thermal_throttle = true, |
649 | .support_ct_kill_exit = true, | 737 | .support_ct_kill_exit = true, |
650 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 738 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE, |
651 | .chain_noise_scale = 1000, | 739 | .chain_noise_scale = 1000, |
652 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, | 740 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
653 | .max_event_log_size = 512, | 741 | .max_event_log_size = 512, |
@@ -655,6 +743,11 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { | |||
655 | .chain_noise_calib_by_driver = true, | 743 | .chain_noise_calib_by_driver = true, |
656 | .need_dc_calib = true, | 744 | .need_dc_calib = true, |
657 | .bt_statistics = true, | 745 | .bt_statistics = true, |
746 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | ||
747 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | ||
748 | .advanced_bt_coexist = true, | ||
749 | .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, | ||
750 | .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, | ||
658 | }; | 751 | }; |
659 | 752 | ||
660 | struct iwl_cfg iwl6000g2b_bg_cfg = { | 753 | struct iwl_cfg iwl6000g2b_bg_cfg = { |
@@ -683,7 +776,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { | |||
683 | .supports_idle = true, | 776 | .supports_idle = true, |
684 | .adv_thermal_throttle = true, | 777 | .adv_thermal_throttle = true, |
685 | .support_ct_kill_exit = true, | 778 | .support_ct_kill_exit = true, |
686 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 779 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE, |
687 | .chain_noise_scale = 1000, | 780 | .chain_noise_scale = 1000, |
688 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, | 781 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
689 | .max_event_log_size = 512, | 782 | .max_event_log_size = 512, |
@@ -691,6 +784,11 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { | |||
691 | .chain_noise_calib_by_driver = true, | 784 | .chain_noise_calib_by_driver = true, |
692 | .need_dc_calib = true, | 785 | .need_dc_calib = true, |
693 | .bt_statistics = true, | 786 | .bt_statistics = true, |
787 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | ||
788 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | ||
789 | .advanced_bt_coexist = true, | ||
790 | .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, | ||
791 | .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, | ||
694 | }; | 792 | }; |
695 | 793 | ||
696 | /* | 794 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c index c4c5691032a6..84ad62958535 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c | |||
@@ -625,7 +625,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp) | |||
625 | 625 | ||
626 | data = &(priv->sensitivity_data); | 626 | data = &(priv->sensitivity_data); |
627 | 627 | ||
628 | if (!iwl_is_associated(priv)) { | 628 | if (!iwl_is_any_associated(priv)) { |
629 | IWL_DEBUG_CALIB(priv, "<< - not associated\n"); | 629 | IWL_DEBUG_CALIB(priv, "<< - not associated\n"); |
630 | return; | 630 | return; |
631 | } | 631 | } |
@@ -763,6 +763,12 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) | |||
763 | unsigned long flags; | 763 | unsigned long flags; |
764 | struct statistics_rx_non_phy *rx_info; | 764 | struct statistics_rx_non_phy *rx_info; |
765 | u8 first_chain; | 765 | u8 first_chain; |
766 | /* | ||
767 | * MULTI-FIXME: | ||
768 | * When we support multiple interfaces on different channels, | ||
769 | * this must be modified/fixed. | ||
770 | */ | ||
771 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
766 | 772 | ||
767 | if (priv->disable_chain_noise_cal) | 773 | if (priv->disable_chain_noise_cal) |
768 | return; | 774 | return; |
@@ -793,8 +799,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) | |||
793 | return; | 799 | return; |
794 | } | 800 | } |
795 | 801 | ||
796 | rxon_band24 = !!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK); | 802 | rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); |
797 | rxon_chnum = le16_to_cpu(priv->staging_rxon.channel); | 803 | rxon_chnum = le16_to_cpu(ctx->staging.channel); |
798 | if (priv->cfg->bt_statistics) { | 804 | if (priv->cfg->bt_statistics) { |
799 | stat_band24 = !!(((struct iwl_bt_notif_statistics *) | 805 | stat_band24 = !!(((struct iwl_bt_notif_statistics *) |
800 | stat_resp)->flag & | 806 | stat_resp)->flag & |
@@ -914,7 +920,11 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) | |||
914 | * To be safe, simply mask out any chains that we know | 920 | * To be safe, simply mask out any chains that we know |
915 | * are not on the device. | 921 | * are not on the device. |
916 | */ | 922 | */ |
917 | active_chains &= priv->hw_params.valid_rx_ant; | 923 | if (priv->cfg->advanced_bt_coexist && priv->bt_full_concurrent) { |
924 | /* operated as 1x1 in full concurrency mode */ | ||
925 | active_chains &= first_antenna(priv->hw_params.valid_rx_ant); | ||
926 | } else | ||
927 | active_chains &= priv->hw_params.valid_rx_ant; | ||
918 | 928 | ||
919 | num_tx_chains = 0; | 929 | num_tx_chains = 0; |
920 | for (i = 0; i < NUM_RX_CHAINS; i++) { | 930 | for (i = 0; i < NUM_RX_CHAINS; i++) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c index 84939763d178..6fb52abafc8d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c | |||
@@ -37,12 +37,13 @@ | |||
37 | #include "iwl-io.h" | 37 | #include "iwl-io.h" |
38 | #include "iwl-agn.h" | 38 | #include "iwl-agn.h" |
39 | 39 | ||
40 | int iwlagn_send_rxon_assoc(struct iwl_priv *priv) | 40 | int iwlagn_send_rxon_assoc(struct iwl_priv *priv, |
41 | struct iwl_rxon_context *ctx) | ||
41 | { | 42 | { |
42 | int ret = 0; | 43 | int ret = 0; |
43 | struct iwl5000_rxon_assoc_cmd rxon_assoc; | 44 | struct iwl5000_rxon_assoc_cmd rxon_assoc; |
44 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; | 45 | const struct iwl_rxon_cmd *rxon1 = &ctx->staging; |
45 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; | 46 | const struct iwl_rxon_cmd *rxon2 = &ctx->active; |
46 | 47 | ||
47 | if ((rxon1->flags == rxon2->flags) && | 48 | if ((rxon1->flags == rxon2->flags) && |
48 | (rxon1->filter_flags == rxon2->filter_flags) && | 49 | (rxon1->filter_flags == rxon2->filter_flags) && |
@@ -60,23 +61,23 @@ int iwlagn_send_rxon_assoc(struct iwl_priv *priv) | |||
60 | return 0; | 61 | return 0; |
61 | } | 62 | } |
62 | 63 | ||
63 | rxon_assoc.flags = priv->staging_rxon.flags; | 64 | rxon_assoc.flags = ctx->staging.flags; |
64 | rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; | 65 | rxon_assoc.filter_flags = ctx->staging.filter_flags; |
65 | rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; | 66 | rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; |
66 | rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; | 67 | rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; |
67 | rxon_assoc.reserved1 = 0; | 68 | rxon_assoc.reserved1 = 0; |
68 | rxon_assoc.reserved2 = 0; | 69 | rxon_assoc.reserved2 = 0; |
69 | rxon_assoc.reserved3 = 0; | 70 | rxon_assoc.reserved3 = 0; |
70 | rxon_assoc.ofdm_ht_single_stream_basic_rates = | 71 | rxon_assoc.ofdm_ht_single_stream_basic_rates = |
71 | priv->staging_rxon.ofdm_ht_single_stream_basic_rates; | 72 | ctx->staging.ofdm_ht_single_stream_basic_rates; |
72 | rxon_assoc.ofdm_ht_dual_stream_basic_rates = | 73 | rxon_assoc.ofdm_ht_dual_stream_basic_rates = |
73 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; | 74 | ctx->staging.ofdm_ht_dual_stream_basic_rates; |
74 | rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; | 75 | rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; |
75 | rxon_assoc.ofdm_ht_triple_stream_basic_rates = | 76 | rxon_assoc.ofdm_ht_triple_stream_basic_rates = |
76 | priv->staging_rxon.ofdm_ht_triple_stream_basic_rates; | 77 | ctx->staging.ofdm_ht_triple_stream_basic_rates; |
77 | rxon_assoc.acquisition_data = priv->staging_rxon.acquisition_data; | 78 | rxon_assoc.acquisition_data = ctx->staging.acquisition_data; |
78 | 79 | ||
79 | ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, | 80 | ret = iwl_send_cmd_pdu_async(priv, ctx->rxon_assoc_cmd, |
80 | sizeof(rxon_assoc), &rxon_assoc, NULL); | 81 | sizeof(rxon_assoc), &rxon_assoc, NULL); |
81 | if (ret) | 82 | if (ret) |
82 | return ret; | 83 | return ret; |
@@ -184,7 +185,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) | |||
184 | int ret; | 185 | int ret; |
185 | 186 | ||
186 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && | 187 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && |
187 | iwl_is_associated(priv)) { | 188 | iwl_is_any_associated(priv)) { |
188 | struct iwl_calib_chain_noise_reset_cmd cmd; | 189 | struct iwl_calib_chain_noise_reset_cmd cmd; |
189 | 190 | ||
190 | /* clear data for chain noise calibration algorithm */ | 191 | /* clear data for chain noise calibration algorithm */ |
@@ -269,12 +270,95 @@ static int iwlagn_calc_rssi(struct iwl_priv *priv, | |||
269 | return max_rssi - agc - IWLAGN_RSSI_OFFSET; | 270 | return max_rssi - agc - IWLAGN_RSSI_OFFSET; |
270 | } | 271 | } |
271 | 272 | ||
273 | static int iwlagn_set_pan_params(struct iwl_priv *priv) | ||
274 | { | ||
275 | struct iwl_wipan_params_cmd cmd; | ||
276 | struct iwl_rxon_context *ctx_bss, *ctx_pan; | ||
277 | int slot0 = 300, slot1 = 0; | ||
278 | int ret; | ||
279 | |||
280 | if (priv->valid_contexts == BIT(IWL_RXON_CTX_BSS)) | ||
281 | return 0; | ||
282 | |||
283 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); | ||
284 | |||
285 | lockdep_assert_held(&priv->mutex); | ||
286 | |||
287 | ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
288 | ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN]; | ||
289 | |||
290 | memset(&cmd, 0, sizeof(cmd)); | ||
291 | |||
292 | /* only 2 slots are currently allowed */ | ||
293 | cmd.num_slots = 2; | ||
294 | |||
295 | cmd.slots[0].type = 0; /* BSS */ | ||
296 | cmd.slots[1].type = 1; /* PAN */ | ||
297 | |||
298 | if (ctx_bss->vif && ctx_pan->vif) { | ||
299 | int bcnint = ctx_pan->vif->bss_conf.beacon_int; | ||
300 | |||
301 | /* should be set, but seems unused?? */ | ||
302 | cmd.flags |= cpu_to_le16(IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE); | ||
303 | |||
304 | if (ctx_pan->vif->type == NL80211_IFTYPE_AP && | ||
305 | bcnint && | ||
306 | bcnint != ctx_bss->vif->bss_conf.beacon_int) { | ||
307 | IWL_ERR(priv, | ||
308 | "beacon intervals don't match (%d, %d)\n", | ||
309 | ctx_bss->vif->bss_conf.beacon_int, | ||
310 | ctx_pan->vif->bss_conf.beacon_int); | ||
311 | } else | ||
312 | bcnint = max_t(int, bcnint, | ||
313 | ctx_bss->vif->bss_conf.beacon_int); | ||
314 | if (!bcnint) | ||
315 | bcnint = 100; | ||
316 | slot0 = bcnint / 2; | ||
317 | slot1 = bcnint - slot0; | ||
318 | |||
319 | if (test_bit(STATUS_SCAN_HW, &priv->status) || | ||
320 | (!ctx_bss->vif->bss_conf.idle && | ||
321 | !ctx_bss->vif->bss_conf.assoc)) { | ||
322 | slot0 = bcnint * 3 - 20; | ||
323 | slot1 = 20; | ||
324 | } else if (!ctx_pan->vif->bss_conf.idle && | ||
325 | !ctx_pan->vif->bss_conf.assoc) { | ||
326 | slot1 = bcnint * 3 - 20; | ||
327 | slot0 = 20; | ||
328 | } | ||
329 | } else if (ctx_pan->vif) { | ||
330 | slot0 = 0; | ||
331 | slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) * | ||
332 | ctx_pan->vif->bss_conf.beacon_int; | ||
333 | slot1 = max_t(int, 100, slot1); | ||
334 | } | ||
335 | |||
336 | cmd.slots[0].width = cpu_to_le16(slot0); | ||
337 | cmd.slots[1].width = cpu_to_le16(slot1); | ||
338 | |||
339 | ret = iwl_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, sizeof(cmd), &cmd); | ||
340 | if (ret) | ||
341 | IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); | ||
342 | |||
343 | return ret; | ||
344 | } | ||
345 | |||
272 | struct iwl_hcmd_ops iwlagn_hcmd = { | 346 | struct iwl_hcmd_ops iwlagn_hcmd = { |
273 | .rxon_assoc = iwlagn_send_rxon_assoc, | 347 | .rxon_assoc = iwlagn_send_rxon_assoc, |
274 | .commit_rxon = iwl_commit_rxon, | 348 | .commit_rxon = iwl_commit_rxon, |
275 | .set_rxon_chain = iwl_set_rxon_chain, | 349 | .set_rxon_chain = iwl_set_rxon_chain, |
276 | .set_tx_ant = iwlagn_send_tx_ant_config, | 350 | .set_tx_ant = iwlagn_send_tx_ant_config, |
277 | .send_bt_config = iwl_send_bt_config, | 351 | .send_bt_config = iwl_send_bt_config, |
352 | .set_pan_params = iwlagn_set_pan_params, | ||
353 | }; | ||
354 | |||
355 | struct iwl_hcmd_ops iwlagn_bt_hcmd = { | ||
356 | .rxon_assoc = iwlagn_send_rxon_assoc, | ||
357 | .commit_rxon = iwl_commit_rxon, | ||
358 | .set_rxon_chain = iwl_set_rxon_chain, | ||
359 | .set_tx_ant = iwlagn_send_tx_ant_config, | ||
360 | .send_bt_config = iwlagn_send_advance_bt_config, | ||
361 | .set_pan_params = iwlagn_set_pan_params, | ||
278 | }; | 362 | }; |
279 | 363 | ||
280 | struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = { | 364 | struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index eedd71f5506b..a8f2adfd799e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -247,7 +247,14 @@ static void iwlagn_rx_reply_tx(struct iwl_priv *priv, | |||
247 | struct iwl_ht_agg *agg; | 247 | struct iwl_ht_agg *agg; |
248 | 248 | ||
249 | agg = &priv->stations[sta_id].tid[tid].agg; | 249 | agg = &priv->stations[sta_id].tid[tid].agg; |
250 | 250 | /* | |
251 | * If the BT kill count is non-zero, we'll get this | ||
252 | * notification again. | ||
253 | */ | ||
254 | if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && | ||
255 | priv->cfg->advanced_bt_coexist) { | ||
256 | IWL_WARN(priv, "receive reply tx with bt_kill\n"); | ||
257 | } | ||
251 | iwlagn_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); | 258 | iwlagn_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); |
252 | 259 | ||
253 | /* check if BAR is needed */ | 260 | /* check if BAR is needed */ |
@@ -1156,6 +1163,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1156 | }; | 1163 | }; |
1157 | struct iwl_scan_cmd *scan; | 1164 | struct iwl_scan_cmd *scan; |
1158 | struct ieee80211_conf *conf = NULL; | 1165 | struct ieee80211_conf *conf = NULL; |
1166 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
1159 | u32 rate_flags = 0; | 1167 | u32 rate_flags = 0; |
1160 | u16 cmd_len; | 1168 | u16 cmd_len; |
1161 | u16 rx_chain = 0; | 1169 | u16 rx_chain = 0; |
@@ -1168,6 +1176,9 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1168 | u8 active_chains; | 1176 | u8 active_chains; |
1169 | u8 scan_tx_antennas = priv->hw_params.valid_tx_ant; | 1177 | u8 scan_tx_antennas = priv->hw_params.valid_tx_ant; |
1170 | 1178 | ||
1179 | if (vif) | ||
1180 | ctx = iwl_rxon_ctx_from_vif(vif); | ||
1181 | |||
1171 | conf = ieee80211_get_hw_conf(priv->hw); | 1182 | conf = ieee80211_get_hw_conf(priv->hw); |
1172 | 1183 | ||
1173 | cancel_delayed_work(&priv->scan_check); | 1184 | cancel_delayed_work(&priv->scan_check); |
@@ -1225,7 +1236,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1225 | scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; | 1236 | scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; |
1226 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; | 1237 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; |
1227 | 1238 | ||
1228 | if (iwl_is_associated(priv)) { | 1239 | if (iwl_is_any_associated(priv)) { |
1229 | u16 interval = 0; | 1240 | u16 interval = 0; |
1230 | u32 extra; | 1241 | u32 extra; |
1231 | u32 suspend_time = 100; | 1242 | u32 suspend_time = 100; |
@@ -1276,13 +1287,15 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1276 | IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); | 1287 | IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); |
1277 | 1288 | ||
1278 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 1289 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
1279 | scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; | 1290 | scan->tx_cmd.sta_id = ctx->bcast_sta_id; |
1280 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 1291 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
1281 | 1292 | ||
1282 | switch (priv->scan_band) { | 1293 | switch (priv->scan_band) { |
1283 | case IEEE80211_BAND_2GHZ: | 1294 | case IEEE80211_BAND_2GHZ: |
1284 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 1295 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
1285 | chan_mod = le32_to_cpu(priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_MSK) | 1296 | chan_mod = le32_to_cpu( |
1297 | priv->contexts[IWL_RXON_CTX_BSS].active.flags & | ||
1298 | RXON_FLG_CHANNEL_MODE_MSK) | ||
1286 | >> RXON_FLG_CHANNEL_MODE_POS; | 1299 | >> RXON_FLG_CHANNEL_MODE_POS; |
1287 | if (chan_mod == CHANNEL_MODE_PURE_40) { | 1300 | if (chan_mod == CHANNEL_MODE_PURE_40) { |
1288 | rate = IWL_RATE_6M_PLCP; | 1301 | rate = IWL_RATE_6M_PLCP; |
@@ -1290,6 +1303,12 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1290 | rate = IWL_RATE_1M_PLCP; | 1303 | rate = IWL_RATE_1M_PLCP; |
1291 | rate_flags = RATE_MCS_CCK_MSK; | 1304 | rate_flags = RATE_MCS_CCK_MSK; |
1292 | } | 1305 | } |
1306 | /* | ||
1307 | * Internal scans are passive, so we can indiscriminately set | ||
1308 | * the BT ignore flag on 2.4 GHz since it applies to TX only. | ||
1309 | */ | ||
1310 | if (priv->cfg->advanced_bt_coexist) | ||
1311 | scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT; | ||
1293 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DISABLED; | 1312 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DISABLED; |
1294 | break; | 1313 | break; |
1295 | case IEEE80211_BAND_5GHZ: | 1314 | case IEEE80211_BAND_5GHZ: |
@@ -1327,6 +1346,12 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1327 | if (priv->cfg->scan_tx_antennas[band]) | 1346 | if (priv->cfg->scan_tx_antennas[band]) |
1328 | scan_tx_antennas = priv->cfg->scan_tx_antennas[band]; | 1347 | scan_tx_antennas = priv->cfg->scan_tx_antennas[band]; |
1329 | 1348 | ||
1349 | if (priv->cfg->advanced_bt_coexist && priv->bt_full_concurrent) { | ||
1350 | /* operated as 1x1 in full concurrency mode */ | ||
1351 | scan_tx_antennas = | ||
1352 | first_antenna(priv->cfg->scan_tx_antennas[band]); | ||
1353 | } | ||
1354 | |||
1330 | priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band], | 1355 | priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band], |
1331 | scan_tx_antennas); | 1356 | scan_tx_antennas); |
1332 | rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]); | 1357 | rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]); |
@@ -1345,6 +1370,11 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1345 | 1370 | ||
1346 | rx_ant = first_antenna(active_chains); | 1371 | rx_ant = first_antenna(active_chains); |
1347 | } | 1372 | } |
1373 | if (priv->cfg->advanced_bt_coexist && priv->bt_full_concurrent) { | ||
1374 | /* operated as 1x1 in full concurrency mode */ | ||
1375 | rx_ant = first_antenna(rx_ant); | ||
1376 | } | ||
1377 | |||
1348 | /* MIMO is not used here, but value is required */ | 1378 | /* MIMO is not used here, but value is required */ |
1349 | rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; | 1379 | rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; |
1350 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; | 1380 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; |
@@ -1394,6 +1424,11 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1394 | scan->len = cpu_to_le16(cmd.len); | 1424 | scan->len = cpu_to_le16(cmd.len); |
1395 | 1425 | ||
1396 | set_bit(STATUS_SCAN_HW, &priv->status); | 1426 | set_bit(STATUS_SCAN_HW, &priv->status); |
1427 | |||
1428 | if (priv->cfg->ops->hcmd->set_pan_params && | ||
1429 | priv->cfg->ops->hcmd->set_pan_params(priv)) | ||
1430 | goto done; | ||
1431 | |||
1397 | if (iwl_send_cmd_sync(priv, &cmd)) | 1432 | if (iwl_send_cmd_sync(priv, &cmd)) |
1398 | goto done; | 1433 | goto done; |
1399 | 1434 | ||
@@ -1420,7 +1455,8 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv, | |||
1420 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | 1455 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; |
1421 | 1456 | ||
1422 | if (add) | 1457 | if (add) |
1423 | return iwl_add_bssid_station(priv, vif->bss_conf.bssid, true, | 1458 | return iwl_add_bssid_station(priv, vif_priv->ctx, |
1459 | vif->bss_conf.bssid, true, | ||
1424 | &vif_priv->ibss_bssid_sta_id); | 1460 | &vif_priv->ibss_bssid_sta_id); |
1425 | return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, | 1461 | return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, |
1426 | vif->bss_conf.bssid); | 1462 | vif->bss_conf.bssid); |
@@ -1453,7 +1489,7 @@ int iwlagn_wait_tx_queue_empty(struct iwl_priv *priv) | |||
1453 | 1489 | ||
1454 | /* waiting for all the tx frames complete might take a while */ | 1490 | /* waiting for all the tx frames complete might take a while */ |
1455 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { | 1491 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { |
1456 | if (cnt == IWL_CMD_QUEUE_NUM) | 1492 | if (cnt == priv->cmd_queue) |
1457 | continue; | 1493 | continue; |
1458 | txq = &priv->txq[cnt]; | 1494 | txq = &priv->txq[cnt]; |
1459 | q = &txq->q; | 1495 | q = &txq->q; |
@@ -1518,3 +1554,377 @@ done: | |||
1518 | ieee80211_wake_queues(priv->hw); | 1554 | ieee80211_wake_queues(priv->hw); |
1519 | mutex_unlock(&priv->mutex); | 1555 | mutex_unlock(&priv->mutex); |
1520 | } | 1556 | } |
1557 | |||
1558 | /* | ||
1559 | * BT coex | ||
1560 | */ | ||
1561 | /* | ||
1562 | * Macros to access the lookup table. | ||
1563 | * | ||
1564 | * The lookup table has 7 inputs: bt3_prio, bt3_txrx, bt_rf_act, wifi_req, | ||
1565 | * wifi_prio, wifi_txrx and wifi_sh_ant_req. | ||
1566 | * | ||
1567 | * It has three outputs: WLAN_ACTIVE, WLAN_KILL and ANT_SWITCH | ||
1568 | * | ||
1569 | * The format is that "registers" 8 through 11 contain the WLAN_ACTIVE bits | ||
1570 | * one after another in 32-bit registers, and "registers" 0 through 7 contain | ||
1571 | * the WLAN_KILL and ANT_SWITCH bits interleaved (in that order). | ||
1572 | * | ||
1573 | * These macros encode that format. | ||
1574 | */ | ||
1575 | #define LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, wifi_req, wifi_prio, \ | ||
1576 | wifi_txrx, wifi_sh_ant_req) \ | ||
1577 | (bt3_prio | (bt3_txrx << 1) | (bt_rf_act << 2) | (wifi_req << 3) | \ | ||
1578 | (wifi_prio << 4) | (wifi_txrx << 5) | (wifi_sh_ant_req << 6)) | ||
1579 | |||
1580 | #define LUT_PTA_WLAN_ACTIVE_OP(lut, op, val) \ | ||
1581 | lut[8 + ((val) >> 5)] op (cpu_to_le32(BIT((val) & 0x1f))) | ||
1582 | #define LUT_TEST_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1583 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1584 | (!!(LUT_PTA_WLAN_ACTIVE_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, \ | ||
1585 | bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \ | ||
1586 | wifi_sh_ant_req)))) | ||
1587 | #define LUT_SET_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1588 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1589 | LUT_PTA_WLAN_ACTIVE_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, \ | ||
1590 | bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \ | ||
1591 | wifi_sh_ant_req)) | ||
1592 | #define LUT_CLEAR_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1593 | wifi_req, wifi_prio, wifi_txrx, \ | ||
1594 | wifi_sh_ant_req) \ | ||
1595 | LUT_PTA_WLAN_ACTIVE_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, \ | ||
1596 | bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \ | ||
1597 | wifi_sh_ant_req)) | ||
1598 | |||
1599 | #define LUT_WLAN_KILL_OP(lut, op, val) \ | ||
1600 | lut[(val) >> 4] op (cpu_to_le32(BIT(((val) << 1) & 0x1e))) | ||
1601 | #define LUT_TEST_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1602 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1603 | (!!(LUT_WLAN_KILL_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1604 | wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)))) | ||
1605 | #define LUT_SET_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1606 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1607 | LUT_WLAN_KILL_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1608 | wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) | ||
1609 | #define LUT_CLEAR_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1610 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1611 | LUT_WLAN_KILL_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1612 | wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) | ||
1613 | |||
1614 | #define LUT_ANT_SWITCH_OP(lut, op, val) \ | ||
1615 | lut[(val) >> 4] op (cpu_to_le32(BIT((((val) << 1) & 0x1e) + 1))) | ||
1616 | #define LUT_TEST_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1617 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1618 | (!!(LUT_ANT_SWITCH_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1619 | wifi_req, wifi_prio, wifi_txrx, \ | ||
1620 | wifi_sh_ant_req)))) | ||
1621 | #define LUT_SET_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1622 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1623 | LUT_ANT_SWITCH_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1624 | wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) | ||
1625 | #define LUT_CLEAR_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \ | ||
1626 | wifi_prio, wifi_txrx, wifi_sh_ant_req) \ | ||
1627 | LUT_ANT_SWITCH_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \ | ||
1628 | wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req)) | ||
1629 | |||
1630 | static const __le32 iwlagn_def_3w_lookup[12] = { | ||
1631 | cpu_to_le32(0xaaaaaaaa), | ||
1632 | cpu_to_le32(0xaaaaaaaa), | ||
1633 | cpu_to_le32(0xaeaaaaaa), | ||
1634 | cpu_to_le32(0xaaaaaaaa), | ||
1635 | cpu_to_le32(0xcc00ff28), | ||
1636 | cpu_to_le32(0x0000aaaa), | ||
1637 | cpu_to_le32(0xcc00aaaa), | ||
1638 | cpu_to_le32(0x0000aaaa), | ||
1639 | cpu_to_le32(0xc0004000), | ||
1640 | cpu_to_le32(0x00004000), | ||
1641 | cpu_to_le32(0xf0005000), | ||
1642 | cpu_to_le32(0xf0004000), | ||
1643 | }; | ||
1644 | |||
1645 | static const __le32 iwlagn_concurrent_lookup[12] = { | ||
1646 | cpu_to_le32(0xaaaaaaaa), | ||
1647 | cpu_to_le32(0xaaaaaaaa), | ||
1648 | cpu_to_le32(0xaaaaaaaa), | ||
1649 | cpu_to_le32(0xaaaaaaaa), | ||
1650 | cpu_to_le32(0xaaaaaaaa), | ||
1651 | cpu_to_le32(0xaaaaaaaa), | ||
1652 | cpu_to_le32(0xaaaaaaaa), | ||
1653 | cpu_to_le32(0xaaaaaaaa), | ||
1654 | cpu_to_le32(0x00000000), | ||
1655 | cpu_to_le32(0x00000000), | ||
1656 | cpu_to_le32(0x00000000), | ||
1657 | cpu_to_le32(0x00000000), | ||
1658 | }; | ||
1659 | |||
1660 | void iwlagn_send_advance_bt_config(struct iwl_priv *priv) | ||
1661 | { | ||
1662 | struct iwlagn_bt_cmd bt_cmd = { | ||
1663 | .max_kill = IWLAGN_BT_MAX_KILL_DEFAULT, | ||
1664 | .bt3_timer_t7_value = IWLAGN_BT3_T7_DEFAULT, | ||
1665 | .bt3_prio_sample_time = IWLAGN_BT3_PRIO_SAMPLE_DEFAULT, | ||
1666 | .bt3_timer_t2_value = IWLAGN_BT3_T2_DEFAULT, | ||
1667 | }; | ||
1668 | |||
1669 | BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) != | ||
1670 | sizeof(bt_cmd.bt3_lookup_table)); | ||
1671 | |||
1672 | bt_cmd.prio_boost = priv->cfg->bt_prio_boost; | ||
1673 | bt_cmd.kill_ack_mask = priv->kill_ack_mask; | ||
1674 | bt_cmd.kill_cts_mask = priv->kill_cts_mask; | ||
1675 | bt_cmd.valid = priv->bt_valid; | ||
1676 | |||
1677 | /* | ||
1678 | * Configure BT coex mode to "no coexistence" when the | ||
1679 | * user disabled BT coexistence, we have no interface | ||
1680 | * (might be in monitor mode), or the interface is in | ||
1681 | * IBSS mode (no proper uCode support for coex then). | ||
1682 | */ | ||
1683 | if (!bt_coex_active || priv->iw_mode == NL80211_IFTYPE_ADHOC) { | ||
1684 | bt_cmd.flags = 0; | ||
1685 | } else { | ||
1686 | bt_cmd.flags = IWLAGN_BT_FLAG_COEX_MODE_3W << | ||
1687 | IWLAGN_BT_FLAG_COEX_MODE_SHIFT; | ||
1688 | if (priv->bt_ch_announce) | ||
1689 | bt_cmd.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION; | ||
1690 | IWL_DEBUG_INFO(priv, "BT coex flag: 0X%x\n", bt_cmd.flags); | ||
1691 | } | ||
1692 | if (priv->bt_full_concurrent) | ||
1693 | memcpy(bt_cmd.bt3_lookup_table, iwlagn_concurrent_lookup, | ||
1694 | sizeof(iwlagn_concurrent_lookup)); | ||
1695 | else | ||
1696 | memcpy(bt_cmd.bt3_lookup_table, iwlagn_def_3w_lookup, | ||
1697 | sizeof(iwlagn_def_3w_lookup)); | ||
1698 | |||
1699 | IWL_DEBUG_INFO(priv, "BT coex %s in %s mode\n", | ||
1700 | bt_cmd.flags ? "active" : "disabled", | ||
1701 | priv->bt_full_concurrent ? | ||
1702 | "full concurrency" : "3-wire"); | ||
1703 | |||
1704 | if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, sizeof(bt_cmd), &bt_cmd)) | ||
1705 | IWL_ERR(priv, "failed to send BT Coex Config\n"); | ||
1706 | |||
1707 | /* | ||
1708 | * When we are doing a restart, need to also reconfigure BT | ||
1709 | * SCO to the device. If not doing a restart, bt_sco_active | ||
1710 | * will always be false, so there's no need to have an extra | ||
1711 | * variable to check for it. | ||
1712 | */ | ||
1713 | if (priv->bt_sco_active) { | ||
1714 | struct iwlagn_bt_sco_cmd sco_cmd = { .flags = 0 }; | ||
1715 | |||
1716 | if (priv->bt_sco_active) | ||
1717 | sco_cmd.flags |= IWLAGN_BT_SCO_ACTIVE; | ||
1718 | if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_SCO, | ||
1719 | sizeof(sco_cmd), &sco_cmd)) | ||
1720 | IWL_ERR(priv, "failed to send BT SCO command\n"); | ||
1721 | } | ||
1722 | } | ||
1723 | |||
1724 | static void iwlagn_bt_traffic_change_work(struct work_struct *work) | ||
1725 | { | ||
1726 | struct iwl_priv *priv = | ||
1727 | container_of(work, struct iwl_priv, bt_traffic_change_work); | ||
1728 | struct iwl_rxon_context *ctx; | ||
1729 | int smps_request = -1; | ||
1730 | |||
1731 | IWL_DEBUG_INFO(priv, "BT traffic load changes: %d\n", | ||
1732 | priv->bt_traffic_load); | ||
1733 | |||
1734 | switch (priv->bt_traffic_load) { | ||
1735 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1736 | smps_request = IEEE80211_SMPS_AUTOMATIC; | ||
1737 | break; | ||
1738 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1739 | smps_request = IEEE80211_SMPS_DYNAMIC; | ||
1740 | break; | ||
1741 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1742 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1743 | smps_request = IEEE80211_SMPS_STATIC; | ||
1744 | break; | ||
1745 | default: | ||
1746 | IWL_ERR(priv, "Invalid BT traffic load: %d\n", | ||
1747 | priv->bt_traffic_load); | ||
1748 | break; | ||
1749 | } | ||
1750 | |||
1751 | mutex_lock(&priv->mutex); | ||
1752 | |||
1753 | if (priv->cfg->ops->lib->update_chain_flags) | ||
1754 | priv->cfg->ops->lib->update_chain_flags(priv); | ||
1755 | |||
1756 | if (smps_request != -1) { | ||
1757 | for_each_context(priv, ctx) { | ||
1758 | if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION) | ||
1759 | ieee80211_request_smps(ctx->vif, smps_request); | ||
1760 | } | ||
1761 | } | ||
1762 | |||
1763 | mutex_unlock(&priv->mutex); | ||
1764 | } | ||
1765 | |||
1766 | static void iwlagn_print_uartmsg(struct iwl_priv *priv, | ||
1767 | struct iwl_bt_uart_msg *uart_msg) | ||
1768 | { | ||
1769 | IWL_DEBUG_NOTIF(priv, "Message Type = 0x%X, SSN = 0x%X, " | ||
1770 | "Update Req = 0x%X", | ||
1771 | (BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >> | ||
1772 | BT_UART_MSG_FRAME1MSGTYPE_POS, | ||
1773 | (BT_UART_MSG_FRAME1SSN_MSK & uart_msg->frame1) >> | ||
1774 | BT_UART_MSG_FRAME1SSN_POS, | ||
1775 | (BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >> | ||
1776 | BT_UART_MSG_FRAME1UPDATEREQ_POS); | ||
1777 | |||
1778 | IWL_DEBUG_NOTIF(priv, "Open connections = 0x%X, Traffic load = 0x%X, " | ||
1779 | "Chl_SeqN = 0x%X, In band = 0x%X", | ||
1780 | (BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >> | ||
1781 | BT_UART_MSG_FRAME2OPENCONNECTIONS_POS, | ||
1782 | (BT_UART_MSG_FRAME2TRAFFICLOAD_MSK & uart_msg->frame2) >> | ||
1783 | BT_UART_MSG_FRAME2TRAFFICLOAD_POS, | ||
1784 | (BT_UART_MSG_FRAME2CHLSEQN_MSK & uart_msg->frame2) >> | ||
1785 | BT_UART_MSG_FRAME2CHLSEQN_POS, | ||
1786 | (BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >> | ||
1787 | BT_UART_MSG_FRAME2INBAND_POS); | ||
1788 | |||
1789 | IWL_DEBUG_NOTIF(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, " | ||
1790 | "ACL = 0x%X, Master = 0x%X, OBEX = 0x%X", | ||
1791 | (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >> | ||
1792 | BT_UART_MSG_FRAME3SCOESCO_POS, | ||
1793 | (BT_UART_MSG_FRAME3SNIFF_MSK & uart_msg->frame3) >> | ||
1794 | BT_UART_MSG_FRAME3SNIFF_POS, | ||
1795 | (BT_UART_MSG_FRAME3A2DP_MSK & uart_msg->frame3) >> | ||
1796 | BT_UART_MSG_FRAME3A2DP_POS, | ||
1797 | (BT_UART_MSG_FRAME3ACL_MSK & uart_msg->frame3) >> | ||
1798 | BT_UART_MSG_FRAME3ACL_POS, | ||
1799 | (BT_UART_MSG_FRAME3MASTER_MSK & uart_msg->frame3) >> | ||
1800 | BT_UART_MSG_FRAME3MASTER_POS, | ||
1801 | (BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >> | ||
1802 | BT_UART_MSG_FRAME3OBEX_POS); | ||
1803 | |||
1804 | IWL_DEBUG_NOTIF(priv, "Idle duration = 0x%X", | ||
1805 | (BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >> | ||
1806 | BT_UART_MSG_FRAME4IDLEDURATION_POS); | ||
1807 | |||
1808 | IWL_DEBUG_NOTIF(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, " | ||
1809 | "eSCO Retransmissions = 0x%X", | ||
1810 | (BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >> | ||
1811 | BT_UART_MSG_FRAME5TXACTIVITY_POS, | ||
1812 | (BT_UART_MSG_FRAME5RXACTIVITY_MSK & uart_msg->frame5) >> | ||
1813 | BT_UART_MSG_FRAME5RXACTIVITY_POS, | ||
1814 | (BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >> | ||
1815 | BT_UART_MSG_FRAME5ESCORETRANSMIT_POS); | ||
1816 | |||
1817 | IWL_DEBUG_NOTIF(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X", | ||
1818 | (BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >> | ||
1819 | BT_UART_MSG_FRAME6SNIFFINTERVAL_POS, | ||
1820 | (BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >> | ||
1821 | BT_UART_MSG_FRAME6DISCOVERABLE_POS); | ||
1822 | |||
1823 | IWL_DEBUG_NOTIF(priv, "Sniff Activity = 0x%X, Inquiry/Page SR Mode = " | ||
1824 | "0x%X, Connectable = 0x%X", | ||
1825 | (BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >> | ||
1826 | BT_UART_MSG_FRAME7SNIFFACTIVITY_POS, | ||
1827 | (BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_MSK & uart_msg->frame7) >> | ||
1828 | BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_POS, | ||
1829 | (BT_UART_MSG_FRAME7CONNECTABLE_MSK & uart_msg->frame7) >> | ||
1830 | BT_UART_MSG_FRAME7CONNECTABLE_POS); | ||
1831 | } | ||
1832 | |||
1833 | static void iwlagn_set_kill_ack_msk(struct iwl_priv *priv, | ||
1834 | struct iwl_bt_uart_msg *uart_msg) | ||
1835 | { | ||
1836 | u8 kill_ack_msk; | ||
1837 | __le32 bt_kill_ack_msg[2] = { | ||
1838 | cpu_to_le32(0xFFFFFFF), cpu_to_le32(0xFFFFFC00) }; | ||
1839 | |||
1840 | kill_ack_msk = (((BT_UART_MSG_FRAME3A2DP_MSK | | ||
1841 | BT_UART_MSG_FRAME3SNIFF_MSK | | ||
1842 | BT_UART_MSG_FRAME3SCOESCO_MSK) & | ||
1843 | uart_msg->frame3) == 0) ? 1 : 0; | ||
1844 | if (priv->kill_ack_mask != bt_kill_ack_msg[kill_ack_msk]) { | ||
1845 | priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK; | ||
1846 | priv->kill_ack_mask = bt_kill_ack_msg[kill_ack_msk]; | ||
1847 | /* schedule to send runtime bt_config */ | ||
1848 | queue_work(priv->workqueue, &priv->bt_runtime_config); | ||
1849 | } | ||
1850 | |||
1851 | } | ||
1852 | |||
1853 | void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, | ||
1854 | struct iwl_rx_mem_buffer *rxb) | ||
1855 | { | ||
1856 | unsigned long flags; | ||
1857 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | ||
1858 | struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif; | ||
1859 | struct iwlagn_bt_sco_cmd sco_cmd = { .flags = 0 }; | ||
1860 | struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg; | ||
1861 | u8 last_traffic_load; | ||
1862 | |||
1863 | IWL_DEBUG_NOTIF(priv, "BT Coex notification:\n"); | ||
1864 | IWL_DEBUG_NOTIF(priv, " status: %d\n", coex->bt_status); | ||
1865 | IWL_DEBUG_NOTIF(priv, " traffic load: %d\n", coex->bt_traffic_load); | ||
1866 | IWL_DEBUG_NOTIF(priv, " CI compliance: %d\n", | ||
1867 | coex->bt_ci_compliance); | ||
1868 | iwlagn_print_uartmsg(priv, uart_msg); | ||
1869 | |||
1870 | last_traffic_load = priv->notif_bt_traffic_load; | ||
1871 | priv->notif_bt_traffic_load = coex->bt_traffic_load; | ||
1872 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
1873 | if (priv->bt_status != coex->bt_status || | ||
1874 | last_traffic_load != coex->bt_traffic_load) { | ||
1875 | if (coex->bt_status) { | ||
1876 | /* BT on */ | ||
1877 | if (!priv->bt_ch_announce) | ||
1878 | priv->bt_traffic_load = | ||
1879 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH; | ||
1880 | else | ||
1881 | priv->bt_traffic_load = | ||
1882 | coex->bt_traffic_load; | ||
1883 | } else { | ||
1884 | /* BT off */ | ||
1885 | priv->bt_traffic_load = | ||
1886 | IWL_BT_COEX_TRAFFIC_LOAD_NONE; | ||
1887 | } | ||
1888 | priv->bt_status = coex->bt_status; | ||
1889 | queue_work(priv->workqueue, | ||
1890 | &priv->bt_traffic_change_work); | ||
1891 | } | ||
1892 | if (priv->bt_sco_active != | ||
1893 | (uart_msg->frame3 & BT_UART_MSG_FRAME3SCOESCO_MSK)) { | ||
1894 | priv->bt_sco_active = uart_msg->frame3 & | ||
1895 | BT_UART_MSG_FRAME3SCOESCO_MSK; | ||
1896 | if (priv->bt_sco_active) | ||
1897 | sco_cmd.flags |= IWLAGN_BT_SCO_ACTIVE; | ||
1898 | iwl_send_cmd_pdu_async(priv, REPLY_BT_COEX_SCO, | ||
1899 | sizeof(sco_cmd), &sco_cmd, NULL); | ||
1900 | } | ||
1901 | } | ||
1902 | |||
1903 | iwlagn_set_kill_ack_msk(priv, uart_msg); | ||
1904 | |||
1905 | /* FIXME: based on notification, adjust the prio_boost */ | ||
1906 | |||
1907 | spin_lock_irqsave(&priv->lock, flags); | ||
1908 | priv->bt_ci_compliance = coex->bt_ci_compliance; | ||
1909 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1910 | } | ||
1911 | |||
1912 | void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv) | ||
1913 | { | ||
1914 | iwlagn_rx_handler_setup(priv); | ||
1915 | priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] = | ||
1916 | iwlagn_bt_coex_profile_notif; | ||
1917 | } | ||
1918 | |||
1919 | void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv) | ||
1920 | { | ||
1921 | iwlagn_setup_deferred_work(priv); | ||
1922 | |||
1923 | INIT_WORK(&priv->bt_traffic_change_work, | ||
1924 | iwlagn_bt_traffic_change_work); | ||
1925 | } | ||
1926 | |||
1927 | void iwlagn_bt_cancel_deferred_work(struct iwl_priv *priv) | ||
1928 | { | ||
1929 | cancel_work_sync(&priv->bt_traffic_change_work); | ||
1930 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index a4563389bad0..57629fba3a7d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -82,7 +82,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
82 | struct iwl_lq_sta *lq_sta); | 82 | struct iwl_lq_sta *lq_sta); |
83 | static void rs_fill_link_cmd(struct iwl_priv *priv, | 83 | static void rs_fill_link_cmd(struct iwl_priv *priv, |
84 | struct iwl_lq_sta *lq_sta, u32 rate_n_flags); | 84 | struct iwl_lq_sta *lq_sta, u32 rate_n_flags); |
85 | static void rs_stay_in_table(struct iwl_lq_sta *lq_sta); | 85 | static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search); |
86 | 86 | ||
87 | 87 | ||
88 | #ifdef CONFIG_MAC80211_DEBUGFS | 88 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -301,7 +301,19 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
301 | struct ieee80211_sta *sta) | 301 | struct ieee80211_sta *sta) |
302 | { | 302 | { |
303 | int ret = -EAGAIN; | 303 | int ret = -EAGAIN; |
304 | u32 load = rs_tl_get_load(lq_data, tid); | 304 | u32 load; |
305 | |||
306 | /* | ||
307 | * Don't create TX aggregation sessions when in high | ||
308 | * BT traffic, as they would just be disrupted by BT. | ||
309 | */ | ||
310 | if (priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) { | ||
311 | IWL_ERR(priv, "BT traffic (%d), no aggregation allowed\n", | ||
312 | priv->bt_traffic_load); | ||
313 | return ret; | ||
314 | } | ||
315 | |||
316 | load = rs_tl_get_load(lq_data, tid); | ||
305 | 317 | ||
306 | if (load > IWL_AGG_LOAD_THRESHOLD) { | 318 | if (load > IWL_AGG_LOAD_THRESHOLD) { |
307 | IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", | 319 | IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", |
@@ -590,11 +602,13 @@ static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, | |||
590 | * Green-field mode is valid if the station supports it and | 602 | * Green-field mode is valid if the station supports it and |
591 | * there are no non-GF stations present in the BSS. | 603 | * there are no non-GF stations present in the BSS. |
592 | */ | 604 | */ |
593 | static inline u8 rs_use_green(struct ieee80211_sta *sta, | 605 | static bool rs_use_green(struct ieee80211_sta *sta) |
594 | struct iwl_ht_config *ht_conf) | ||
595 | { | 606 | { |
607 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | ||
608 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
609 | |||
596 | return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && | 610 | return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && |
597 | !(ht_conf->non_GF_STA_present); | 611 | !(ctx->ht.non_gf_sta_present); |
598 | } | 612 | } |
599 | 613 | ||
600 | /** | 614 | /** |
@@ -746,6 +760,32 @@ static bool table_type_matches(struct iwl_scale_tbl_info *a, | |||
746 | (a->is_SGI == b->is_SGI); | 760 | (a->is_SGI == b->is_SGI); |
747 | } | 761 | } |
748 | 762 | ||
763 | static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, | ||
764 | struct iwl_lq_sta *lq_sta) | ||
765 | { | ||
766 | struct iwl_scale_tbl_info *tbl; | ||
767 | bool full_concurrent; | ||
768 | unsigned long flags; | ||
769 | |||
770 | spin_lock_irqsave(&priv->lock, flags); | ||
771 | if (priv->bt_ci_compliance && priv->bt_ant_couple_ok) | ||
772 | full_concurrent = true; | ||
773 | else | ||
774 | full_concurrent = false; | ||
775 | spin_unlock_irqrestore(&priv->lock, flags); | ||
776 | |||
777 | if (priv->bt_full_concurrent != full_concurrent) { | ||
778 | priv->bt_full_concurrent = full_concurrent; | ||
779 | |||
780 | /* Update uCode's rate table. */ | ||
781 | tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | ||
782 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); | ||
783 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); | ||
784 | |||
785 | queue_work(priv->workqueue, &priv->bt_full_concurrency); | ||
786 | } | ||
787 | } | ||
788 | |||
749 | /* | 789 | /* |
750 | * mac80211 sends us Tx status | 790 | * mac80211 sends us Tx status |
751 | */ | 791 | */ |
@@ -765,6 +805,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
765 | u32 tx_rate; | 805 | u32 tx_rate; |
766 | struct iwl_scale_tbl_info tbl_type; | 806 | struct iwl_scale_tbl_info tbl_type; |
767 | struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; | 807 | struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; |
808 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | ||
809 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
768 | 810 | ||
769 | IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); | 811 | IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); |
770 | 812 | ||
@@ -831,7 +873,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
831 | lq_sta->missed_rate_counter++; | 873 | lq_sta->missed_rate_counter++; |
832 | if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { | 874 | if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { |
833 | lq_sta->missed_rate_counter = 0; | 875 | lq_sta->missed_rate_counter = 0; |
834 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); | 876 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); |
835 | } | 877 | } |
836 | /* Regardless, ignore this status info for outdated rate */ | 878 | /* Regardless, ignore this status info for outdated rate */ |
837 | return; | 879 | return; |
@@ -862,7 +904,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
862 | * no matching table found, let's by-pass the data collection | 904 | * no matching table found, let's by-pass the data collection |
863 | * and continue to perform rate scale to find the rate table | 905 | * and continue to perform rate scale to find the rate table |
864 | */ | 906 | */ |
865 | rs_stay_in_table(lq_sta); | 907 | rs_stay_in_table(lq_sta, true); |
866 | goto done; | 908 | goto done; |
867 | } | 909 | } |
868 | 910 | ||
@@ -928,6 +970,10 @@ done: | |||
928 | /* See if there's a better rate or modulation mode to try. */ | 970 | /* See if there's a better rate or modulation mode to try. */ |
929 | if (sta && sta->supp_rates[sband->band]) | 971 | if (sta && sta->supp_rates[sband->band]) |
930 | rs_rate_scale_perform(priv, skb, sta, lq_sta); | 972 | rs_rate_scale_perform(priv, skb, sta, lq_sta); |
973 | |||
974 | /* Is there a need to switch between full concurrency and 3-wire? */ | ||
975 | if (priv->bt_ant_couple_ok) | ||
976 | rs_bt_update_lq(priv, ctx, lq_sta); | ||
931 | } | 977 | } |
932 | 978 | ||
933 | /* | 979 | /* |
@@ -1121,6 +1167,8 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1121 | u16 rate_mask; | 1167 | u16 rate_mask; |
1122 | s32 rate; | 1168 | s32 rate; |
1123 | s8 is_green = lq_sta->is_green; | 1169 | s8 is_green = lq_sta->is_green; |
1170 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | ||
1171 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
1124 | 1172 | ||
1125 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) | 1173 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) |
1126 | return -1; | 1174 | return -1; |
@@ -1141,7 +1189,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1141 | tbl->max_search = IWL_MAX_SEARCH; | 1189 | tbl->max_search = IWL_MAX_SEARCH; |
1142 | rate_mask = lq_sta->active_mimo2_rate; | 1190 | rate_mask = lq_sta->active_mimo2_rate; |
1143 | 1191 | ||
1144 | if (iwl_is_ht40_tx_allowed(priv, &sta->ht_cap)) | 1192 | if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) |
1145 | tbl->is_ht40 = 1; | 1193 | tbl->is_ht40 = 1; |
1146 | else | 1194 | else |
1147 | tbl->is_ht40 = 0; | 1195 | tbl->is_ht40 = 0; |
@@ -1175,6 +1223,8 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv, | |||
1175 | u16 rate_mask; | 1223 | u16 rate_mask; |
1176 | s32 rate; | 1224 | s32 rate; |
1177 | s8 is_green = lq_sta->is_green; | 1225 | s8 is_green = lq_sta->is_green; |
1226 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | ||
1227 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
1178 | 1228 | ||
1179 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) | 1229 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) |
1180 | return -1; | 1230 | return -1; |
@@ -1195,7 +1245,7 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv, | |||
1195 | tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; | 1245 | tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; |
1196 | rate_mask = lq_sta->active_mimo3_rate; | 1246 | rate_mask = lq_sta->active_mimo3_rate; |
1197 | 1247 | ||
1198 | if (iwl_is_ht40_tx_allowed(priv, &sta->ht_cap)) | 1248 | if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) |
1199 | tbl->is_ht40 = 1; | 1249 | tbl->is_ht40 = 1; |
1200 | else | 1250 | else |
1201 | tbl->is_ht40 = 0; | 1251 | tbl->is_ht40 = 0; |
@@ -1230,6 +1280,8 @@ static int rs_switch_to_siso(struct iwl_priv *priv, | |||
1230 | u16 rate_mask; | 1280 | u16 rate_mask; |
1231 | u8 is_green = lq_sta->is_green; | 1281 | u8 is_green = lq_sta->is_green; |
1232 | s32 rate; | 1282 | s32 rate; |
1283 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | ||
1284 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
1233 | 1285 | ||
1234 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) | 1286 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) |
1235 | return -1; | 1287 | return -1; |
@@ -1242,7 +1294,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, | |||
1242 | tbl->max_search = IWL_MAX_SEARCH; | 1294 | tbl->max_search = IWL_MAX_SEARCH; |
1243 | rate_mask = lq_sta->active_siso_rate; | 1295 | rate_mask = lq_sta->active_siso_rate; |
1244 | 1296 | ||
1245 | if (iwl_is_ht40_tx_allowed(priv, &sta->ht_cap)) | 1297 | if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) |
1246 | tbl->is_ht40 = 1; | 1298 | tbl->is_ht40 = 1; |
1247 | else | 1299 | else |
1248 | tbl->is_ht40 = 0; | 1300 | tbl->is_ht40 = 0; |
@@ -1286,12 +1338,45 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1286 | int ret = 0; | 1338 | int ret = 0; |
1287 | u8 update_search_tbl_counter = 0; | 1339 | u8 update_search_tbl_counter = 0; |
1288 | 1340 | ||
1341 | switch (priv->bt_traffic_load) { | ||
1342 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1343 | /* nothing */ | ||
1344 | break; | ||
1345 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1346 | /* avoid antenna B unless MIMO */ | ||
1347 | valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); | ||
1348 | if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2) | ||
1349 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | ||
1350 | break; | ||
1351 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1352 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1353 | /* avoid antenna B and MIMO */ | ||
1354 | valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); | ||
1355 | if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && | ||
1356 | tbl->action != IWL_LEGACY_SWITCH_SISO) | ||
1357 | tbl->action = IWL_LEGACY_SWITCH_SISO; | ||
1358 | break; | ||
1359 | default: | ||
1360 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | ||
1361 | break; | ||
1362 | } | ||
1363 | |||
1289 | if (!iwl_ht_enabled(priv)) | 1364 | if (!iwl_ht_enabled(priv)) |
1290 | /* stay in Legacy */ | 1365 | /* stay in Legacy */ |
1291 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | 1366 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1292 | else if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE && | 1367 | else if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE && |
1293 | tbl->action > IWL_LEGACY_SWITCH_SISO) | 1368 | tbl->action > IWL_LEGACY_SWITCH_SISO) |
1294 | tbl->action = IWL_LEGACY_SWITCH_SISO; | 1369 | tbl->action = IWL_LEGACY_SWITCH_SISO; |
1370 | |||
1371 | /* configure as 1x1 if bt full concurrency */ | ||
1372 | if (priv->bt_full_concurrent) { | ||
1373 | if (!iwl_ht_enabled(priv)) | ||
1374 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | ||
1375 | else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) | ||
1376 | tbl->action = IWL_LEGACY_SWITCH_SISO; | ||
1377 | valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); | ||
1378 | } | ||
1379 | |||
1295 | start_action = tbl->action; | 1380 | start_action = tbl->action; |
1296 | for (; ;) { | 1381 | for (; ;) { |
1297 | lq_sta->action_counter++; | 1382 | lq_sta->action_counter++; |
@@ -1307,7 +1392,10 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1307 | break; | 1392 | break; |
1308 | 1393 | ||
1309 | /* Don't change antenna if success has been great */ | 1394 | /* Don't change antenna if success has been great */ |
1310 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | 1395 | if (window->success_ratio >= IWL_RS_GOOD_RATIO && |
1396 | !priv->bt_full_concurrent && | ||
1397 | priv->bt_traffic_load == | ||
1398 | IWL_BT_COEX_TRAFFIC_LOAD_NONE) | ||
1311 | break; | 1399 | break; |
1312 | 1400 | ||
1313 | /* Set up search table to try other antenna */ | 1401 | /* Set up search table to try other antenna */ |
@@ -1425,11 +1513,41 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1425 | u8 update_search_tbl_counter = 0; | 1513 | u8 update_search_tbl_counter = 0; |
1426 | int ret; | 1514 | int ret; |
1427 | 1515 | ||
1516 | switch (priv->bt_traffic_load) { | ||
1517 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1518 | /* nothing */ | ||
1519 | break; | ||
1520 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1521 | /* avoid antenna B unless MIMO */ | ||
1522 | valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); | ||
1523 | if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) | ||
1524 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | ||
1525 | break; | ||
1526 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1527 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1528 | /* avoid antenna B and MIMO */ | ||
1529 | valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); | ||
1530 | if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) | ||
1531 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | ||
1532 | break; | ||
1533 | default: | ||
1534 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | ||
1535 | break; | ||
1536 | } | ||
1537 | |||
1428 | if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE && | 1538 | if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE && |
1429 | tbl->action > IWL_SISO_SWITCH_ANTENNA2) { | 1539 | tbl->action > IWL_SISO_SWITCH_ANTENNA2) { |
1430 | /* stay in SISO */ | 1540 | /* stay in SISO */ |
1431 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | 1541 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1432 | } | 1542 | } |
1543 | |||
1544 | /* configure as 1x1 if bt full concurrency */ | ||
1545 | if (priv->bt_full_concurrent) { | ||
1546 | valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); | ||
1547 | if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) | ||
1548 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | ||
1549 | } | ||
1550 | |||
1433 | start_action = tbl->action; | 1551 | start_action = tbl->action; |
1434 | for (;;) { | 1552 | for (;;) { |
1435 | lq_sta->action_counter++; | 1553 | lq_sta->action_counter++; |
@@ -1437,14 +1555,16 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1437 | case IWL_SISO_SWITCH_ANTENNA1: | 1555 | case IWL_SISO_SWITCH_ANTENNA1: |
1438 | case IWL_SISO_SWITCH_ANTENNA2: | 1556 | case IWL_SISO_SWITCH_ANTENNA2: |
1439 | IWL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); | 1557 | IWL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); |
1440 | |||
1441 | if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && | 1558 | if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && |
1442 | tx_chains_num <= 1) || | 1559 | tx_chains_num <= 1) || |
1443 | (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && | 1560 | (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && |
1444 | tx_chains_num <= 2)) | 1561 | tx_chains_num <= 2)) |
1445 | break; | 1562 | break; |
1446 | 1563 | ||
1447 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | 1564 | if (window->success_ratio >= IWL_RS_GOOD_RATIO && |
1565 | !priv->bt_full_concurrent && | ||
1566 | priv->bt_traffic_load == | ||
1567 | IWL_BT_COEX_TRAFFIC_LOAD_NONE) | ||
1448 | break; | 1568 | break; |
1449 | 1569 | ||
1450 | memcpy(search_tbl, tbl, sz); | 1570 | memcpy(search_tbl, tbl, sz); |
@@ -1564,12 +1684,40 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv, | |||
1564 | u8 update_search_tbl_counter = 0; | 1684 | u8 update_search_tbl_counter = 0; |
1565 | int ret; | 1685 | int ret; |
1566 | 1686 | ||
1687 | switch (priv->bt_traffic_load) { | ||
1688 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1689 | /* nothing */ | ||
1690 | break; | ||
1691 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1692 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1693 | /* avoid antenna B and MIMO */ | ||
1694 | if (tbl->action != IWL_MIMO2_SWITCH_SISO_A) | ||
1695 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; | ||
1696 | break; | ||
1697 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1698 | /* avoid antenna B unless MIMO */ | ||
1699 | if (tbl->action == IWL_MIMO2_SWITCH_SISO_B || | ||
1700 | tbl->action == IWL_MIMO2_SWITCH_SISO_C) | ||
1701 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; | ||
1702 | break; | ||
1703 | default: | ||
1704 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | ||
1705 | break; | ||
1706 | } | ||
1707 | |||
1567 | if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) && | 1708 | if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) && |
1568 | (tbl->action < IWL_MIMO2_SWITCH_SISO_A || | 1709 | (tbl->action < IWL_MIMO2_SWITCH_SISO_A || |
1569 | tbl->action > IWL_MIMO2_SWITCH_SISO_C)) { | 1710 | tbl->action > IWL_MIMO2_SWITCH_SISO_C)) { |
1570 | /* switch in SISO */ | 1711 | /* switch in SISO */ |
1571 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; | 1712 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; |
1572 | } | 1713 | } |
1714 | |||
1715 | /* configure as 1x1 if bt full concurrency */ | ||
1716 | if (priv->bt_full_concurrent && | ||
1717 | (tbl->action < IWL_MIMO2_SWITCH_SISO_A || | ||
1718 | tbl->action > IWL_MIMO2_SWITCH_SISO_C)) | ||
1719 | tbl->action = IWL_MIMO2_SWITCH_SISO_A; | ||
1720 | |||
1573 | start_action = tbl->action; | 1721 | start_action = tbl->action; |
1574 | for (;;) { | 1722 | for (;;) { |
1575 | lq_sta->action_counter++; | 1723 | lq_sta->action_counter++; |
@@ -1706,12 +1854,40 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv, | |||
1706 | int ret; | 1854 | int ret; |
1707 | u8 update_search_tbl_counter = 0; | 1855 | u8 update_search_tbl_counter = 0; |
1708 | 1856 | ||
1857 | switch (priv->bt_traffic_load) { | ||
1858 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1859 | /* nothing */ | ||
1860 | break; | ||
1861 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1862 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1863 | /* avoid antenna B and MIMO */ | ||
1864 | if (tbl->action != IWL_MIMO3_SWITCH_SISO_A) | ||
1865 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | ||
1866 | break; | ||
1867 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1868 | /* avoid antenna B unless MIMO */ | ||
1869 | if (tbl->action == IWL_MIMO3_SWITCH_SISO_B || | ||
1870 | tbl->action == IWL_MIMO3_SWITCH_SISO_C) | ||
1871 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | ||
1872 | break; | ||
1873 | default: | ||
1874 | IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); | ||
1875 | break; | ||
1876 | } | ||
1877 | |||
1709 | if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) && | 1878 | if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) && |
1710 | (tbl->action < IWL_MIMO3_SWITCH_SISO_A || | 1879 | (tbl->action < IWL_MIMO3_SWITCH_SISO_A || |
1711 | tbl->action > IWL_MIMO3_SWITCH_SISO_C)) { | 1880 | tbl->action > IWL_MIMO3_SWITCH_SISO_C)) { |
1712 | /* switch in SISO */ | 1881 | /* switch in SISO */ |
1713 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | 1882 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; |
1714 | } | 1883 | } |
1884 | |||
1885 | /* configure as 1x1 if bt full concurrency */ | ||
1886 | if (priv->bt_full_concurrent && | ||
1887 | (tbl->action < IWL_MIMO3_SWITCH_SISO_A || | ||
1888 | tbl->action > IWL_MIMO3_SWITCH_SISO_C)) | ||
1889 | tbl->action = IWL_MIMO3_SWITCH_SISO_A; | ||
1890 | |||
1715 | start_action = tbl->action; | 1891 | start_action = tbl->action; |
1716 | for (;;) { | 1892 | for (;;) { |
1717 | lq_sta->action_counter++; | 1893 | lq_sta->action_counter++; |
@@ -1839,7 +2015,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv, | |||
1839 | * 2) # times calling this function | 2015 | * 2) # times calling this function |
1840 | * 3) elapsed time in this mode (not used, for now) | 2016 | * 3) elapsed time in this mode (not used, for now) |
1841 | */ | 2017 | */ |
1842 | static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) | 2018 | static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) |
1843 | { | 2019 | { |
1844 | struct iwl_scale_tbl_info *tbl; | 2020 | struct iwl_scale_tbl_info *tbl; |
1845 | int i; | 2021 | int i; |
@@ -1870,7 +2046,8 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) | |||
1870 | * allow a new search. Also (below) reset all bitmaps and | 2046 | * allow a new search. Also (below) reset all bitmaps and |
1871 | * stats in active history. | 2047 | * stats in active history. |
1872 | */ | 2048 | */ |
1873 | if ((lq_sta->total_failed > lq_sta->max_failure_limit) || | 2049 | if (force_search || |
2050 | (lq_sta->total_failed > lq_sta->max_failure_limit) || | ||
1874 | (lq_sta->total_success > lq_sta->max_success_limit) || | 2051 | (lq_sta->total_success > lq_sta->max_success_limit) || |
1875 | ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) | 2052 | ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) |
1876 | && (flush_interval_passed))) { | 2053 | && (flush_interval_passed))) { |
@@ -1919,6 +2096,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) | |||
1919 | * return rate_n_flags as used in the table | 2096 | * return rate_n_flags as used in the table |
1920 | */ | 2097 | */ |
1921 | static u32 rs_update_rate_tbl(struct iwl_priv *priv, | 2098 | static u32 rs_update_rate_tbl(struct iwl_priv *priv, |
2099 | struct iwl_rxon_context *ctx, | ||
1922 | struct iwl_lq_sta *lq_sta, | 2100 | struct iwl_lq_sta *lq_sta, |
1923 | struct iwl_scale_tbl_info *tbl, | 2101 | struct iwl_scale_tbl_info *tbl, |
1924 | int index, u8 is_green) | 2102 | int index, u8 is_green) |
@@ -1928,7 +2106,7 @@ static u32 rs_update_rate_tbl(struct iwl_priv *priv, | |||
1928 | /* Update uCode's rate table. */ | 2106 | /* Update uCode's rate table. */ |
1929 | rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); | 2107 | rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); |
1930 | rs_fill_link_cmd(priv, lq_sta, rate); | 2108 | rs_fill_link_cmd(priv, lq_sta, rate); |
1931 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); | 2109 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); |
1932 | 2110 | ||
1933 | return rate; | 2111 | return rate; |
1934 | } | 2112 | } |
@@ -1967,6 +2145,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1967 | s32 sr; | 2145 | s32 sr; |
1968 | u8 tid = MAX_TID_COUNT; | 2146 | u8 tid = MAX_TID_COUNT; |
1969 | struct iwl_tid_data *tid_data; | 2147 | struct iwl_tid_data *tid_data; |
2148 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | ||
2149 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
1970 | 2150 | ||
1971 | IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); | 2151 | IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); |
1972 | 2152 | ||
@@ -2005,7 +2185,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2005 | if (is_legacy(tbl->lq_type)) | 2185 | if (is_legacy(tbl->lq_type)) |
2006 | lq_sta->is_green = 0; | 2186 | lq_sta->is_green = 0; |
2007 | else | 2187 | else |
2008 | lq_sta->is_green = rs_use_green(sta, &priv->current_ht_config); | 2188 | lq_sta->is_green = rs_use_green(sta); |
2009 | is_green = lq_sta->is_green; | 2189 | is_green = lq_sta->is_green; |
2010 | 2190 | ||
2011 | /* current tx rate */ | 2191 | /* current tx rate */ |
@@ -2044,7 +2224,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2044 | tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 2224 | tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
2045 | /* get "active" rate info */ | 2225 | /* get "active" rate info */ |
2046 | index = iwl_hwrate_to_plcp_idx(tbl->current_rate); | 2226 | index = iwl_hwrate_to_plcp_idx(tbl->current_rate); |
2047 | rate = rs_update_rate_tbl(priv, lq_sta, | 2227 | rate = rs_update_rate_tbl(priv, ctx, lq_sta, |
2048 | tbl, index, is_green); | 2228 | tbl, index, is_green); |
2049 | } | 2229 | } |
2050 | return; | 2230 | return; |
@@ -2086,7 +2266,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2086 | 2266 | ||
2087 | /* Should we stay with this modulation mode, | 2267 | /* Should we stay with this modulation mode, |
2088 | * or search for a new one? */ | 2268 | * or search for a new one? */ |
2089 | rs_stay_in_table(lq_sta); | 2269 | rs_stay_in_table(lq_sta, false); |
2090 | 2270 | ||
2091 | goto out; | 2271 | goto out; |
2092 | } | 2272 | } |
@@ -2234,6 +2414,28 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2234 | if (iwl_tx_ant_restriction(priv) != IWL_ANT_OK_MULTI && | 2414 | if (iwl_tx_ant_restriction(priv) != IWL_ANT_OK_MULTI && |
2235 | (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) | 2415 | (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) |
2236 | scale_action = -1; | 2416 | scale_action = -1; |
2417 | |||
2418 | if ((priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && | ||
2419 | (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) { | ||
2420 | if (lq_sta->last_bt_traffic > priv->bt_traffic_load) { | ||
2421 | /* | ||
2422 | * don't set scale_action, don't want to scale up if | ||
2423 | * the rate scale doesn't otherwise think that is a | ||
2424 | * good idea. | ||
2425 | */ | ||
2426 | } else if (lq_sta->last_bt_traffic <= priv->bt_traffic_load) { | ||
2427 | scale_action = -1; | ||
2428 | } | ||
2429 | } | ||
2430 | lq_sta->last_bt_traffic = priv->bt_traffic_load; | ||
2431 | |||
2432 | if ((priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && | ||
2433 | (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) { | ||
2434 | /* search for a new modulation */ | ||
2435 | rs_stay_in_table(lq_sta, true); | ||
2436 | goto lq_update; | ||
2437 | } | ||
2438 | |||
2237 | switch (scale_action) { | 2439 | switch (scale_action) { |
2238 | case -1: | 2440 | case -1: |
2239 | /* Decrease starting rate, update uCode's rate table */ | 2441 | /* Decrease starting rate, update uCode's rate table */ |
@@ -2264,13 +2466,13 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2264 | lq_update: | 2466 | lq_update: |
2265 | /* Replace uCode's rate table for the destination station. */ | 2467 | /* Replace uCode's rate table for the destination station. */ |
2266 | if (update_lq) | 2468 | if (update_lq) |
2267 | rate = rs_update_rate_tbl(priv, lq_sta, | 2469 | rate = rs_update_rate_tbl(priv, ctx, lq_sta, |
2268 | tbl, index, is_green); | 2470 | tbl, index, is_green); |
2269 | 2471 | ||
2270 | if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) { | 2472 | if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) { |
2271 | /* Should we stay with this modulation mode, | 2473 | /* Should we stay with this modulation mode, |
2272 | * or search for a new one? */ | 2474 | * or search for a new one? */ |
2273 | rs_stay_in_table(lq_sta); | 2475 | rs_stay_in_table(lq_sta, false); |
2274 | } | 2476 | } |
2275 | /* | 2477 | /* |
2276 | * Search for new modulation mode if we're: | 2478 | * Search for new modulation mode if we're: |
@@ -2306,7 +2508,7 @@ lq_update: | |||
2306 | IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", | 2508 | IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", |
2307 | tbl->current_rate, index); | 2509 | tbl->current_rate, index); |
2308 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); | 2510 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); |
2309 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); | 2511 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); |
2310 | } else | 2512 | } else |
2311 | done_search = 1; | 2513 | done_search = 1; |
2312 | } | 2514 | } |
@@ -2376,12 +2578,17 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2376 | int rate_idx; | 2578 | int rate_idx; |
2377 | int i; | 2579 | int i; |
2378 | u32 rate; | 2580 | u32 rate; |
2379 | u8 use_green = rs_use_green(sta, &priv->current_ht_config); | 2581 | u8 use_green = rs_use_green(sta); |
2380 | u8 active_tbl = 0; | 2582 | u8 active_tbl = 0; |
2381 | u8 valid_tx_ant; | 2583 | u8 valid_tx_ant; |
2584 | struct iwl_station_priv *sta_priv; | ||
2585 | struct iwl_rxon_context *ctx; | ||
2382 | 2586 | ||
2383 | if (!sta || !lq_sta) | 2587 | if (!sta || !lq_sta) |
2384 | goto out; | 2588 | return; |
2589 | |||
2590 | sta_priv = (void *)sta->drv_priv; | ||
2591 | ctx = sta_priv->common.ctx; | ||
2385 | 2592 | ||
2386 | i = lq_sta->last_txrate_idx; | 2593 | i = lq_sta->last_txrate_idx; |
2387 | 2594 | ||
@@ -2413,9 +2620,7 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2413 | rs_set_expected_tpt_table(lq_sta, tbl); | 2620 | rs_set_expected_tpt_table(lq_sta, tbl); |
2414 | rs_fill_link_cmd(NULL, lq_sta, rate); | 2621 | rs_fill_link_cmd(NULL, lq_sta, rate); |
2415 | priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; | 2622 | priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; |
2416 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_SYNC, true); | 2623 | iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); |
2417 | out: | ||
2418 | return; | ||
2419 | } | 2624 | } |
2420 | 2625 | ||
2421 | static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | 2626 | static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, |
@@ -2543,7 +2748,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i | |||
2543 | lq_sta->is_dup = 0; | 2748 | lq_sta->is_dup = 0; |
2544 | lq_sta->max_rate_idx = -1; | 2749 | lq_sta->max_rate_idx = -1; |
2545 | lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; | 2750 | lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; |
2546 | lq_sta->is_green = rs_use_green(sta, &priv->current_ht_config); | 2751 | lq_sta->is_green = rs_use_green(sta); |
2547 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); | 2752 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); |
2548 | lq_sta->band = priv->band; | 2753 | lq_sta->band = priv->band; |
2549 | /* | 2754 | /* |
@@ -2616,6 +2821,12 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, | |||
2616 | rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, | 2821 | rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, |
2617 | &tbl_type, &rate_idx); | 2822 | &tbl_type, &rate_idx); |
2618 | 2823 | ||
2824 | if (priv && priv->bt_full_concurrent) { | ||
2825 | /* 1x1 only */ | ||
2826 | tbl_type.ant_type = | ||
2827 | first_antenna(priv->hw_params.valid_tx_ant); | ||
2828 | } | ||
2829 | |||
2619 | /* How many times should we repeat the initial rate? */ | 2830 | /* How many times should we repeat the initial rate? */ |
2620 | if (is_legacy(tbl_type.lq_type)) { | 2831 | if (is_legacy(tbl_type.lq_type)) { |
2621 | ant_toggle_cnt = 1; | 2832 | ant_toggle_cnt = 1; |
@@ -2640,9 +2851,12 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, | |||
2640 | 2851 | ||
2641 | index++; | 2852 | index++; |
2642 | repeat_rate--; | 2853 | repeat_rate--; |
2643 | 2854 | if (priv) { | |
2644 | if (priv) | 2855 | if (priv->bt_full_concurrent) |
2645 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2856 | valid_tx_ant = ANT_A; |
2857 | else | ||
2858 | valid_tx_ant = priv->hw_params.valid_tx_ant; | ||
2859 | } | ||
2646 | 2860 | ||
2647 | /* Fill rest of rate table */ | 2861 | /* Fill rest of rate table */ |
2648 | while (index < LINK_QUAL_MAX_RETRY_NUM) { | 2862 | while (index < LINK_QUAL_MAX_RETRY_NUM) { |
@@ -2657,7 +2871,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, | |||
2657 | rs_toggle_antenna(valid_tx_ant, | 2871 | rs_toggle_antenna(valid_tx_ant, |
2658 | &new_rate, &tbl_type)) | 2872 | &new_rate, &tbl_type)) |
2659 | ant_toggle_cnt = 1; | 2873 | ant_toggle_cnt = 1; |
2660 | } | 2874 | } |
2661 | 2875 | ||
2662 | /* Override next rate if needed for debug purposes */ | 2876 | /* Override next rate if needed for debug purposes */ |
2663 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); | 2877 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); |
@@ -2672,6 +2886,12 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, | |||
2672 | rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, | 2886 | rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, |
2673 | &rate_idx); | 2887 | &rate_idx); |
2674 | 2888 | ||
2889 | if (priv && priv->bt_full_concurrent) { | ||
2890 | /* 1x1 only */ | ||
2891 | tbl_type.ant_type = | ||
2892 | first_antenna(priv->hw_params.valid_tx_ant); | ||
2893 | } | ||
2894 | |||
2675 | /* Indicate to uCode which entries might be MIMO. | 2895 | /* Indicate to uCode which entries might be MIMO. |
2676 | * If initial rate was MIMO, this will finally end up | 2896 | * If initial rate was MIMO, this will finally end up |
2677 | * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ | 2897 | * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ |
@@ -2788,6 +3008,9 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2788 | char buf[64]; | 3008 | char buf[64]; |
2789 | int buf_size; | 3009 | int buf_size; |
2790 | u32 parsed_rate; | 3010 | u32 parsed_rate; |
3011 | struct iwl_station_priv *sta_priv = | ||
3012 | container_of(lq_sta, struct iwl_station_priv, lq_sta); | ||
3013 | struct iwl_rxon_context *ctx = sta_priv->common.ctx; | ||
2791 | 3014 | ||
2792 | priv = lq_sta->drv; | 3015 | priv = lq_sta->drv; |
2793 | memset(buf, 0, sizeof(buf)); | 3016 | memset(buf, 0, sizeof(buf)); |
@@ -2810,7 +3033,8 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2810 | 3033 | ||
2811 | if (lq_sta->dbg_fixed_rate) { | 3034 | if (lq_sta->dbg_fixed_rate) { |
2812 | rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); | 3035 | rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); |
2813 | iwl_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false); | 3036 | iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, |
3037 | false); | ||
2814 | } | 3038 | } |
2815 | 3039 | ||
2816 | return count; | 3040 | return count; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h index 8292f6d48ec6..3970ab1deaf9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h | |||
@@ -432,6 +432,8 @@ struct iwl_lq_sta { | |||
432 | u32 last_rate_n_flags; | 432 | u32 last_rate_n_flags; |
433 | /* packets destined for this STA are aggregated */ | 433 | /* packets destined for this STA are aggregated */ |
434 | u8 is_agg; | 434 | u8 is_agg; |
435 | /* BT traffic this sta was last updated in */ | ||
436 | u8 last_bt_traffic; | ||
435 | }; | 437 | }; |
436 | 438 | ||
437 | static inline u8 num_of_ant(u8 mask) | 439 | static inline u8 num_of_ant(u8 mask) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c index 30298ea56a24..07b2c6cadf51 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c | |||
@@ -416,18 +416,26 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) | |||
416 | /* stop ct_kill_waiting_tm timer */ | 416 | /* stop ct_kill_waiting_tm timer */ |
417 | del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm); | 417 | del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm); |
418 | if (changed) { | 418 | if (changed) { |
419 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | ||
420 | |||
421 | if (tt->state >= IWL_TI_1) { | 419 | if (tt->state >= IWL_TI_1) { |
422 | /* force PI = IWL_POWER_INDEX_5 in the case of TI > 0 */ | 420 | /* force PI = IWL_POWER_INDEX_5 in the case of TI > 0 */ |
423 | tt->tt_power_mode = IWL_POWER_INDEX_5; | 421 | tt->tt_power_mode = IWL_POWER_INDEX_5; |
424 | if (!iwl_ht_enabled(priv)) | 422 | |
425 | /* disable HT */ | 423 | if (!iwl_ht_enabled(priv)) { |
426 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | | 424 | struct iwl_rxon_context *ctx; |
427 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | | 425 | |
428 | RXON_FLG_HT40_PROT_MSK | | 426 | for_each_context(priv, ctx) { |
429 | RXON_FLG_HT_PROT_MSK); | 427 | struct iwl_rxon_cmd *rxon; |
430 | else { | 428 | |
429 | rxon = &ctx->staging; | ||
430 | |||
431 | /* disable HT */ | ||
432 | rxon->flags &= ~( | ||
433 | RXON_FLG_CHANNEL_MODE_MSK | | ||
434 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | | ||
435 | RXON_FLG_HT40_PROT_MSK | | ||
436 | RXON_FLG_HT_PROT_MSK); | ||
437 | } | ||
438 | } else { | ||
431 | /* check HT capability and set | 439 | /* check HT capability and set |
432 | * according to the system HT capability | 440 | * according to the system HT capability |
433 | * in case get disabled before */ | 441 | * in case get disabled before */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index 3fc982e87921..5950184d9860 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -71,18 +71,6 @@ static const u8 tid_to_ac[] = { | |||
71 | 2, 3, 3, 2, 1, 1, 0, 0 | 71 | 2, 3, 3, 2, 1, 1, 0, 0 |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static const u8 ac_to_fifo[] = { | ||
75 | IWL_TX_FIFO_VO, | ||
76 | IWL_TX_FIFO_VI, | ||
77 | IWL_TX_FIFO_BE, | ||
78 | IWL_TX_FIFO_BK, | ||
79 | }; | ||
80 | |||
81 | static inline int get_fifo_from_ac(u8 ac) | ||
82 | { | ||
83 | return ac_to_fifo[ac]; | ||
84 | } | ||
85 | |||
86 | static inline int get_ac_from_tid(u16 tid) | 74 | static inline int get_ac_from_tid(u16 tid) |
87 | { | 75 | { |
88 | if (likely(tid < ARRAY_SIZE(tid_to_ac))) | 76 | if (likely(tid < ARRAY_SIZE(tid_to_ac))) |
@@ -92,10 +80,10 @@ static inline int get_ac_from_tid(u16 tid) | |||
92 | return -EINVAL; | 80 | return -EINVAL; |
93 | } | 81 | } |
94 | 82 | ||
95 | static inline int get_fifo_from_tid(u16 tid) | 83 | static inline int get_fifo_from_tid(struct iwl_rxon_context *ctx, u16 tid) |
96 | { | 84 | { |
97 | if (likely(tid < ARRAY_SIZE(tid_to_ac))) | 85 | if (likely(tid < ARRAY_SIZE(tid_to_ac))) |
98 | return get_fifo_from_ac(tid_to_ac[tid]); | 86 | return ctx->ac_to_fifo[tid_to_ac[tid]]; |
99 | 87 | ||
100 | /* no support for TIDs 8-15 yet */ | 88 | /* no support for TIDs 8-15 yet */ |
101 | return -EINVAL; | 89 | return -EINVAL; |
@@ -118,7 +106,7 @@ void iwlagn_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
118 | 106 | ||
119 | WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); | 107 | WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); |
120 | 108 | ||
121 | if (txq_id != IWL_CMD_QUEUE_NUM) { | 109 | if (txq_id != priv->cmd_queue) { |
122 | sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; | 110 | sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; |
123 | sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl; | 111 | sec_ctl = txq->cmd[txq->q.write_ptr]->cmd.tx.sec_ctl; |
124 | 112 | ||
@@ -155,7 +143,7 @@ void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, | |||
155 | 143 | ||
156 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); | 144 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); |
157 | 145 | ||
158 | if (txq_id != IWL_CMD_QUEUE_NUM) | 146 | if (txq_id != priv->cmd_queue) |
159 | sta_id = txq->cmd[read_ptr]->cmd.tx.sta_id; | 147 | sta_id = txq->cmd[read_ptr]->cmd.tx.sta_id; |
160 | 148 | ||
161 | bc_ent = cpu_to_le16(1 | (sta_id << 12)); | 149 | bc_ent = cpu_to_le16(1 | (sta_id << 12)); |
@@ -333,19 +321,15 @@ void iwlagn_txq_set_sched(struct iwl_priv *priv, u32 mask) | |||
333 | iwl_write_prph(priv, IWLAGN_SCD_TXFACT, mask); | 321 | iwl_write_prph(priv, IWLAGN_SCD_TXFACT, mask); |
334 | } | 322 | } |
335 | 323 | ||
336 | static inline int get_queue_from_ac(u16 ac) | ||
337 | { | ||
338 | return ac; | ||
339 | } | ||
340 | |||
341 | /* | 324 | /* |
342 | * handle build REPLY_TX command notification. | 325 | * handle build REPLY_TX command notification. |
343 | */ | 326 | */ |
344 | static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, | 327 | static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, |
345 | struct iwl_tx_cmd *tx_cmd, | 328 | struct sk_buff *skb, |
346 | struct ieee80211_tx_info *info, | 329 | struct iwl_tx_cmd *tx_cmd, |
347 | struct ieee80211_hdr *hdr, | 330 | struct ieee80211_tx_info *info, |
348 | u8 std_id) | 331 | struct ieee80211_hdr *hdr, |
332 | u8 std_id) | ||
349 | { | 333 | { |
350 | __le16 fc = hdr->frame_control; | 334 | __le16 fc = hdr->frame_control; |
351 | __le32 tx_flags = tx_cmd->tx_flags; | 335 | __le32 tx_flags = tx_cmd->tx_flags; |
@@ -365,6 +349,12 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, | |||
365 | 349 | ||
366 | if (ieee80211_is_back_req(fc)) | 350 | if (ieee80211_is_back_req(fc)) |
367 | tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; | 351 | tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; |
352 | else if (info->band == IEEE80211_BAND_2GHZ && | ||
353 | priv->cfg->advanced_bt_coexist && | ||
354 | (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || | ||
355 | ieee80211_is_reassoc_req(fc) || | ||
356 | skb->protocol == cpu_to_be16(ETH_P_PAE))) | ||
357 | tx_flags |= TX_CMD_FLG_IGNORE_BT; | ||
368 | 358 | ||
369 | 359 | ||
370 | tx_cmd->sta_id = std_id; | 360 | tx_cmd->sta_id = std_id; |
@@ -454,7 +444,12 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, | |||
454 | rate_flags |= RATE_MCS_CCK_MSK; | 444 | rate_flags |= RATE_MCS_CCK_MSK; |
455 | 445 | ||
456 | /* Set up antennas */ | 446 | /* Set up antennas */ |
457 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, | 447 | if (priv->cfg->advanced_bt_coexist && priv->bt_full_concurrent) { |
448 | /* operated as 1x1 in full concurrency mode */ | ||
449 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, | ||
450 | first_antenna(priv->hw_params.valid_tx_ant)); | ||
451 | } else | ||
452 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, | ||
458 | priv->hw_params.valid_tx_ant); | 453 | priv->hw_params.valid_tx_ant); |
459 | rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); | 454 | rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); |
460 | 455 | ||
@@ -519,6 +514,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
519 | struct iwl_device_cmd *out_cmd; | 514 | struct iwl_device_cmd *out_cmd; |
520 | struct iwl_cmd_meta *out_meta; | 515 | struct iwl_cmd_meta *out_meta; |
521 | struct iwl_tx_cmd *tx_cmd; | 516 | struct iwl_tx_cmd *tx_cmd; |
517 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
522 | int swq_id, txq_id; | 518 | int swq_id, txq_id; |
523 | dma_addr_t phys_addr; | 519 | dma_addr_t phys_addr; |
524 | dma_addr_t txcmd_phys; | 520 | dma_addr_t txcmd_phys; |
@@ -533,6 +529,9 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
533 | u8 *qc = NULL; | 529 | u8 *qc = NULL; |
534 | unsigned long flags; | 530 | unsigned long flags; |
535 | 531 | ||
532 | if (info->control.vif) | ||
533 | ctx = iwl_rxon_ctx_from_vif(info->control.vif); | ||
534 | |||
536 | spin_lock_irqsave(&priv->lock, flags); | 535 | spin_lock_irqsave(&priv->lock, flags); |
537 | if (iwl_is_rfkill(priv)) { | 536 | if (iwl_is_rfkill(priv)) { |
538 | IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); | 537 | IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); |
@@ -553,7 +552,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
553 | hdr_len = ieee80211_hdrlen(fc); | 552 | hdr_len = ieee80211_hdrlen(fc); |
554 | 553 | ||
555 | /* Find index into station table for destination station */ | 554 | /* Find index into station table for destination station */ |
556 | sta_id = iwl_sta_id_or_broadcast(priv, info->control.sta); | 555 | sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta); |
557 | if (sta_id == IWL_INVALID_STATION) { | 556 | if (sta_id == IWL_INVALID_STATION) { |
558 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 557 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
559 | hdr->addr1); | 558 | hdr->addr1); |
@@ -565,8 +564,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
565 | if (sta) | 564 | if (sta) |
566 | sta_priv = (void *)sta->drv_priv; | 565 | sta_priv = (void *)sta->drv_priv; |
567 | 566 | ||
568 | if (sta_priv && sta_id != priv->hw_params.bcast_sta_id && | 567 | if (sta_priv && sta_priv->asleep) { |
569 | sta_priv->asleep) { | ||
570 | WARN_ON(!(info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)); | 568 | WARN_ON(!(info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)); |
571 | /* | 569 | /* |
572 | * This sends an asynchronous command to the device, | 570 | * This sends an asynchronous command to the device, |
@@ -580,7 +578,20 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
580 | iwl_sta_modify_sleep_tx_count(priv, sta_id, 1); | 578 | iwl_sta_modify_sleep_tx_count(priv, sta_id, 1); |
581 | } | 579 | } |
582 | 580 | ||
583 | txq_id = get_queue_from_ac(skb_get_queue_mapping(skb)); | 581 | /* |
582 | * Send this frame after DTIM -- there's a special queue | ||
583 | * reserved for this for contexts that support AP mode. | ||
584 | */ | ||
585 | if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { | ||
586 | txq_id = ctx->mcast_queue; | ||
587 | /* | ||
588 | * The microcode will clear the more data | ||
589 | * bit in the last frame it transmits. | ||
590 | */ | ||
591 | hdr->frame_control |= | ||
592 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | ||
593 | } else | ||
594 | txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; | ||
584 | 595 | ||
585 | /* irqs already disabled/saved above when locking priv->lock */ | 596 | /* irqs already disabled/saved above when locking priv->lock */ |
586 | spin_lock(&priv->sta_lock); | 597 | spin_lock(&priv->sta_lock); |
@@ -625,6 +636,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
625 | /* Set up driver data for this TFD */ | 636 | /* Set up driver data for this TFD */ |
626 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); | 637 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); |
627 | txq->txb[q->write_ptr].skb = skb; | 638 | txq->txb[q->write_ptr].skb = skb; |
639 | txq->txb[q->write_ptr].ctx = ctx; | ||
628 | 640 | ||
629 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ | 641 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ |
630 | out_cmd = txq->cmd[q->write_ptr]; | 642 | out_cmd = txq->cmd[q->write_ptr]; |
@@ -655,7 +667,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
655 | iwlagn_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); | 667 | iwlagn_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); |
656 | 668 | ||
657 | /* TODO need this for burst mode later on */ | 669 | /* TODO need this for burst mode later on */ |
658 | iwlagn_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id); | 670 | iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); |
659 | iwl_dbg_log_tx_data_frame(priv, len, hdr); | 671 | iwl_dbg_log_tx_data_frame(priv, len, hdr); |
660 | 672 | ||
661 | iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc); | 673 | iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, fc); |
@@ -813,7 +825,7 @@ void iwlagn_hw_txq_ctx_free(struct iwl_priv *priv) | |||
813 | /* Tx queues */ | 825 | /* Tx queues */ |
814 | if (priv->txq) { | 826 | if (priv->txq) { |
815 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) | 827 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) |
816 | if (txq_id == IWL_CMD_QUEUE_NUM) | 828 | if (txq_id == priv->cmd_queue) |
817 | iwl_cmd_queue_free(priv); | 829 | iwl_cmd_queue_free(priv); |
818 | else | 830 | else |
819 | iwl_tx_queue_free(priv, txq_id); | 831 | iwl_tx_queue_free(priv, txq_id); |
@@ -870,9 +882,9 @@ int iwlagn_txq_ctx_alloc(struct iwl_priv *priv) | |||
870 | 882 | ||
871 | spin_unlock_irqrestore(&priv->lock, flags); | 883 | spin_unlock_irqrestore(&priv->lock, flags); |
872 | 884 | ||
873 | /* Alloc and init all Tx queues, including the command queue (#4) */ | 885 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ |
874 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 886 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { |
875 | slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ? | 887 | slots_num = (txq_id == priv->cmd_queue) ? |
876 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 888 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
877 | ret = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, | 889 | ret = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num, |
878 | txq_id); | 890 | txq_id); |
@@ -910,7 +922,7 @@ void iwlagn_txq_ctx_reset(struct iwl_priv *priv) | |||
910 | 922 | ||
911 | /* Alloc and init all Tx queues, including the command queue (#4) */ | 923 | /* Alloc and init all Tx queues, including the command queue (#4) */ |
912 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 924 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { |
913 | slots_num = txq_id == IWL_CMD_QUEUE_NUM ? | 925 | slots_num = txq_id == priv->cmd_queue ? |
914 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 926 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
915 | iwl_tx_queue_reset(priv, &priv->txq[txq_id], slots_num, txq_id); | 927 | iwl_tx_queue_reset(priv, &priv->txq[txq_id], slots_num, txq_id); |
916 | } | 928 | } |
@@ -968,7 +980,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
968 | unsigned long flags; | 980 | unsigned long flags; |
969 | struct iwl_tid_data *tid_data; | 981 | struct iwl_tid_data *tid_data; |
970 | 982 | ||
971 | tx_fifo = get_fifo_from_tid(tid); | 983 | tx_fifo = get_fifo_from_tid(iwl_rxon_ctx_from_vif(vif), tid); |
972 | if (unlikely(tx_fifo < 0)) | 984 | if (unlikely(tx_fifo < 0)) |
973 | return tx_fifo; | 985 | return tx_fifo; |
974 | 986 | ||
@@ -1024,12 +1036,12 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
1024 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | 1036 | int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, |
1025 | struct ieee80211_sta *sta, u16 tid) | 1037 | struct ieee80211_sta *sta, u16 tid) |
1026 | { | 1038 | { |
1027 | int tx_fifo_id, txq_id, sta_id, ssn = -1; | 1039 | int tx_fifo_id, txq_id, sta_id, ssn; |
1028 | struct iwl_tid_data *tid_data; | 1040 | struct iwl_tid_data *tid_data; |
1029 | int write_ptr, read_ptr; | 1041 | int write_ptr, read_ptr; |
1030 | unsigned long flags; | 1042 | unsigned long flags; |
1031 | 1043 | ||
1032 | tx_fifo_id = get_fifo_from_tid(tid); | 1044 | tx_fifo_id = get_fifo_from_tid(iwl_rxon_ctx_from_vif(vif), tid); |
1033 | if (unlikely(tx_fifo_id < 0)) | 1045 | if (unlikely(tx_fifo_id < 0)) |
1034 | return tx_fifo_id; | 1046 | return tx_fifo_id; |
1035 | 1047 | ||
@@ -1042,21 +1054,26 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
1042 | 1054 | ||
1043 | spin_lock_irqsave(&priv->sta_lock, flags); | 1055 | spin_lock_irqsave(&priv->sta_lock, flags); |
1044 | 1056 | ||
1045 | if (priv->stations[sta_id].tid[tid].agg.state == | ||
1046 | IWL_EMPTYING_HW_QUEUE_ADDBA) { | ||
1047 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | ||
1048 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
1049 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; | ||
1050 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1051 | return 0; | ||
1052 | } | ||
1053 | |||
1054 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON) | ||
1055 | IWL_WARN(priv, "Stopping AGG while state not ON or starting\n"); | ||
1056 | |||
1057 | tid_data = &priv->stations[sta_id].tid[tid]; | 1057 | tid_data = &priv->stations[sta_id].tid[tid]; |
1058 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; | 1058 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; |
1059 | txq_id = tid_data->agg.txq_id; | 1059 | txq_id = tid_data->agg.txq_id; |
1060 | |||
1061 | switch (priv->stations[sta_id].tid[tid].agg.state) { | ||
1062 | case IWL_EMPTYING_HW_QUEUE_ADDBA: | ||
1063 | /* | ||
1064 | * This can happen if the peer stops aggregation | ||
1065 | * again before we've had a chance to drain the | ||
1066 | * queue we selected previously, i.e. before the | ||
1067 | * session was really started completely. | ||
1068 | */ | ||
1069 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | ||
1070 | goto turn_off; | ||
1071 | case IWL_AGG_ON: | ||
1072 | break; | ||
1073 | default: | ||
1074 | IWL_WARN(priv, "Stopping AGG while state not ON or starting\n"); | ||
1075 | } | ||
1076 | |||
1060 | write_ptr = priv->txq[txq_id].q.write_ptr; | 1077 | write_ptr = priv->txq[txq_id].q.write_ptr; |
1061 | read_ptr = priv->txq[txq_id].q.read_ptr; | 1078 | read_ptr = priv->txq[txq_id].q.read_ptr; |
1062 | 1079 | ||
@@ -1070,6 +1087,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, | |||
1070 | } | 1087 | } |
1071 | 1088 | ||
1072 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); | 1089 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); |
1090 | turn_off: | ||
1073 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; | 1091 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; |
1074 | 1092 | ||
1075 | /* do not restore/save irqs */ | 1093 | /* do not restore/save irqs */ |
@@ -1098,6 +1116,9 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv, | |||
1098 | struct iwl_queue *q = &priv->txq[txq_id].q; | 1116 | struct iwl_queue *q = &priv->txq[txq_id].q; |
1099 | u8 *addr = priv->stations[sta_id].sta.sta.addr; | 1117 | u8 *addr = priv->stations[sta_id].sta.sta.addr; |
1100 | struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; | 1118 | struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; |
1119 | struct iwl_rxon_context *ctx; | ||
1120 | |||
1121 | ctx = &priv->contexts[priv->stations[sta_id].ctxid]; | ||
1101 | 1122 | ||
1102 | lockdep_assert_held(&priv->sta_lock); | 1123 | lockdep_assert_held(&priv->sta_lock); |
1103 | 1124 | ||
@@ -1108,12 +1129,12 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv, | |||
1108 | if ((txq_id == tid_data->agg.txq_id) && | 1129 | if ((txq_id == tid_data->agg.txq_id) && |
1109 | (q->read_ptr == q->write_ptr)) { | 1130 | (q->read_ptr == q->write_ptr)) { |
1110 | u16 ssn = SEQ_TO_SN(tid_data->seq_number); | 1131 | u16 ssn = SEQ_TO_SN(tid_data->seq_number); |
1111 | int tx_fifo = get_fifo_from_tid(tid); | 1132 | int tx_fifo = get_fifo_from_tid(ctx, tid); |
1112 | IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n"); | 1133 | IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n"); |
1113 | priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, | 1134 | priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, |
1114 | ssn, tx_fifo); | 1135 | ssn, tx_fifo); |
1115 | tid_data->agg.state = IWL_AGG_OFF; | 1136 | tid_data->agg.state = IWL_AGG_OFF; |
1116 | ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, addr, tid); | 1137 | ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); |
1117 | } | 1138 | } |
1118 | break; | 1139 | break; |
1119 | case IWL_EMPTYING_HW_QUEUE_ADDBA: | 1140 | case IWL_EMPTYING_HW_QUEUE_ADDBA: |
@@ -1121,7 +1142,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv, | |||
1121 | if (tid_data->tfds_in_queue == 0) { | 1142 | if (tid_data->tfds_in_queue == 0) { |
1122 | IWL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n"); | 1143 | IWL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n"); |
1123 | tid_data->agg.state = IWL_AGG_ON; | 1144 | tid_data->agg.state = IWL_AGG_ON; |
1124 | ieee80211_start_tx_ba_cb_irqsafe(priv->vif, addr, tid); | 1145 | ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); |
1125 | } | 1146 | } |
1126 | break; | 1147 | break; |
1127 | } | 1148 | } |
@@ -1129,14 +1150,14 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv, | |||
1129 | return 0; | 1150 | return 0; |
1130 | } | 1151 | } |
1131 | 1152 | ||
1132 | static void iwlagn_tx_status(struct iwl_priv *priv, struct sk_buff *skb) | 1153 | static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info) |
1133 | { | 1154 | { |
1134 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1155 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; |
1135 | struct ieee80211_sta *sta; | 1156 | struct ieee80211_sta *sta; |
1136 | struct iwl_station_priv *sta_priv; | 1157 | struct iwl_station_priv *sta_priv; |
1137 | 1158 | ||
1138 | rcu_read_lock(); | 1159 | rcu_read_lock(); |
1139 | sta = ieee80211_find_sta(priv->vif, hdr->addr1); | 1160 | sta = ieee80211_find_sta(tx_info->ctx->vif, hdr->addr1); |
1140 | if (sta) { | 1161 | if (sta) { |
1141 | sta_priv = (void *)sta->drv_priv; | 1162 | sta_priv = (void *)sta->drv_priv; |
1142 | /* avoid atomic ops if this isn't a client */ | 1163 | /* avoid atomic ops if this isn't a client */ |
@@ -1146,7 +1167,7 @@ static void iwlagn_tx_status(struct iwl_priv *priv, struct sk_buff *skb) | |||
1146 | } | 1167 | } |
1147 | rcu_read_unlock(); | 1168 | rcu_read_unlock(); |
1148 | 1169 | ||
1149 | ieee80211_tx_status_irqsafe(priv->hw, skb); | 1170 | ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); |
1150 | } | 1171 | } |
1151 | 1172 | ||
1152 | int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | 1173 | int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) |
@@ -1169,7 +1190,7 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | |||
1169 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 1190 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
1170 | 1191 | ||
1171 | tx_info = &txq->txb[txq->q.read_ptr]; | 1192 | tx_info = &txq->txb[txq->q.read_ptr]; |
1172 | iwlagn_tx_status(priv, tx_info->skb); | 1193 | iwlagn_tx_status(priv, tx_info); |
1173 | 1194 | ||
1174 | hdr = (struct ieee80211_hdr *)tx_info->skb->data; | 1195 | hdr = (struct ieee80211_hdr *)tx_info->skb->data; |
1175 | if (hdr && ieee80211_is_data_qos(hdr->frame_control)) | 1196 | if (hdr && ieee80211_is_data_qos(hdr->frame_control)) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index 6f77441cb65a..a7961bf395fc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | |||
@@ -52,6 +52,19 @@ static const s8 iwlagn_default_queue_to_tx_fifo[] = { | |||
52 | IWL_TX_FIFO_UNUSED, | 52 | IWL_TX_FIFO_UNUSED, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static const s8 iwlagn_ipan_queue_to_tx_fifo[] = { | ||
56 | IWL_TX_FIFO_VO, | ||
57 | IWL_TX_FIFO_VI, | ||
58 | IWL_TX_FIFO_BE, | ||
59 | IWL_TX_FIFO_BK, | ||
60 | IWL_TX_FIFO_BK_IPAN, | ||
61 | IWL_TX_FIFO_BE_IPAN, | ||
62 | IWL_TX_FIFO_VI_IPAN, | ||
63 | IWL_TX_FIFO_VO_IPAN, | ||
64 | IWL_TX_FIFO_BE_IPAN, | ||
65 | IWLAGN_CMD_FIFO_NUM, | ||
66 | }; | ||
67 | |||
55 | static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { | 68 | static struct iwl_wimax_coex_event_entry cu_priorities[COEX_NUM_OF_EVENTS] = { |
56 | {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, | 69 | {COEX_CU_UNASSOC_IDLE_RP, COEX_CU_UNASSOC_IDLE_WP, |
57 | 0, COEX_UNASSOC_IDLE_FLAGS}, | 70 | 0, COEX_UNASSOC_IDLE_FLAGS}, |
@@ -329,8 +342,54 @@ static int iwlagn_send_wimax_coex(struct iwl_priv *priv) | |||
329 | sizeof(coex_cmd), &coex_cmd); | 342 | sizeof(coex_cmd), &coex_cmd); |
330 | } | 343 | } |
331 | 344 | ||
345 | static const u8 iwlagn_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = { | ||
346 | ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
347 | (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
348 | ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
349 | (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
350 | ((BT_COEX_PRIO_TBL_PRIO_LOW << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
351 | (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
352 | ((BT_COEX_PRIO_TBL_PRIO_LOW << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
353 | (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
354 | ((BT_COEX_PRIO_TBL_PRIO_HIGH << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
355 | (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
356 | ((BT_COEX_PRIO_TBL_PRIO_HIGH << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
357 | (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
358 | ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
359 | (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
360 | ((BT_COEX_PRIO_TBL_PRIO_COEX_OFF << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
361 | (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
362 | ((BT_COEX_PRIO_TBL_PRIO_COEX_ON << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | | ||
363 | (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), | ||
364 | 0, 0, 0, 0, 0, 0, 0 | ||
365 | }; | ||
366 | |||
367 | static void iwlagn_send_prio_tbl(struct iwl_priv *priv) | ||
368 | { | ||
369 | struct iwl_bt_coex_prio_table_cmd prio_tbl_cmd; | ||
370 | |||
371 | memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl, | ||
372 | sizeof(iwlagn_bt_prio_tbl)); | ||
373 | if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_PRIO_TABLE, | ||
374 | sizeof(prio_tbl_cmd), &prio_tbl_cmd)) | ||
375 | IWL_ERR(priv, "failed to send BT prio tbl command\n"); | ||
376 | } | ||
377 | |||
378 | static void iwlagn_send_bt_env(struct iwl_priv *priv, u8 action, u8 type) | ||
379 | { | ||
380 | struct iwl_bt_coex_prot_env_cmd env_cmd; | ||
381 | |||
382 | env_cmd.action = action; | ||
383 | env_cmd.type = type; | ||
384 | if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_PROT_ENV, | ||
385 | sizeof(env_cmd), &env_cmd)) | ||
386 | IWL_ERR(priv, "failed to send BT env command\n"); | ||
387 | } | ||
388 | |||
389 | |||
332 | int iwlagn_alive_notify(struct iwl_priv *priv) | 390 | int iwlagn_alive_notify(struct iwl_priv *priv) |
333 | { | 391 | { |
392 | const s8 *queues; | ||
334 | u32 a; | 393 | u32 a; |
335 | unsigned long flags; | 394 | unsigned long flags; |
336 | int i, chan; | 395 | int i, chan; |
@@ -365,7 +424,7 @@ int iwlagn_alive_notify(struct iwl_priv *priv) | |||
365 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); | 424 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); |
366 | 425 | ||
367 | iwl_write_prph(priv, IWLAGN_SCD_QUEUECHAIN_SEL, | 426 | iwl_write_prph(priv, IWLAGN_SCD_QUEUECHAIN_SEL, |
368 | IWLAGN_SCD_QUEUECHAIN_SEL_ALL(priv->hw_params.max_txq_num)); | 427 | IWLAGN_SCD_QUEUECHAIN_SEL_ALL(priv)); |
369 | iwl_write_prph(priv, IWLAGN_SCD_AGGR_SEL, 0); | 428 | iwl_write_prph(priv, IWLAGN_SCD_AGGR_SEL, 0); |
370 | 429 | ||
371 | /* initiate the queues */ | 430 | /* initiate the queues */ |
@@ -391,7 +450,13 @@ int iwlagn_alive_notify(struct iwl_priv *priv) | |||
391 | /* Activate all Tx DMA/FIFO channels */ | 450 | /* Activate all Tx DMA/FIFO channels */ |
392 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); | 451 | priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); |
393 | 452 | ||
394 | iwlagn_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); | 453 | /* map queues to FIFOs */ |
454 | if (priv->valid_contexts != BIT(IWL_RXON_CTX_BSS)) | ||
455 | queues = iwlagn_ipan_queue_to_tx_fifo; | ||
456 | else | ||
457 | queues = iwlagn_default_queue_to_tx_fifo; | ||
458 | |||
459 | iwlagn_set_wr_ptrs(priv, priv->cmd_queue, 0); | ||
395 | 460 | ||
396 | /* make sure all queue are not stopped */ | 461 | /* make sure all queue are not stopped */ |
397 | memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); | 462 | memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); |
@@ -400,11 +465,12 @@ int iwlagn_alive_notify(struct iwl_priv *priv) | |||
400 | 465 | ||
401 | /* reset to 0 to enable all the queue first */ | 466 | /* reset to 0 to enable all the queue first */ |
402 | priv->txq_ctx_active_msk = 0; | 467 | priv->txq_ctx_active_msk = 0; |
403 | /* map qos queues to fifos one-to-one */ | 468 | |
404 | BUILD_BUG_ON(ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo) != 10); | 469 | BUILD_BUG_ON(ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo) != 10); |
470 | BUILD_BUG_ON(ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo) != 10); | ||
405 | 471 | ||
406 | for (i = 0; i < ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); i++) { | 472 | for (i = 0; i < 10; i++) { |
407 | int ac = iwlagn_default_queue_to_tx_fifo[i]; | 473 | int ac = queues[i]; |
408 | 474 | ||
409 | iwl_txq_ctx_activate(priv, i); | 475 | iwl_txq_ctx_activate(priv, i); |
410 | 476 | ||
@@ -416,6 +482,25 @@ int iwlagn_alive_notify(struct iwl_priv *priv) | |||
416 | 482 | ||
417 | spin_unlock_irqrestore(&priv->lock, flags); | 483 | spin_unlock_irqrestore(&priv->lock, flags); |
418 | 484 | ||
485 | if (priv->cfg->advanced_bt_coexist) { | ||
486 | /* Configure Bluetooth device coexistence support */ | ||
487 | /* need to perform this before any calibration */ | ||
488 | priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; | ||
489 | priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; | ||
490 | priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; | ||
491 | priv->cfg->ops->hcmd->send_bt_config(priv); | ||
492 | priv->bt_valid = IWLAGN_BT_VALID_ENABLE_FLAGS; | ||
493 | |||
494 | if (bt_coex_active && priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
495 | iwlagn_send_prio_tbl(priv); | ||
496 | iwlagn_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN, | ||
497 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); | ||
498 | iwlagn_send_bt_env(priv, IWL_BT_COEX_ENV_CLOSE, | ||
499 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); | ||
500 | } | ||
501 | |||
502 | } | ||
503 | |||
419 | iwlagn_send_wimax_coex(priv); | 504 | iwlagn_send_wimax_coex(priv); |
420 | 505 | ||
421 | iwlagn_set_Xtal_calib(priv); | 506 | iwlagn_set_Xtal_calib(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 3ced9ea9c5fe..ad0e67f5c0d4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -87,6 +87,9 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); | |||
87 | MODULE_LICENSE("GPL"); | 87 | MODULE_LICENSE("GPL"); |
88 | MODULE_ALIAS("iwl4965"); | 88 | MODULE_ALIAS("iwl4965"); |
89 | 89 | ||
90 | static int iwlagn_ant_coupling; | ||
91 | static bool iwlagn_bt_ch_announce = 1; | ||
92 | |||
90 | /** | 93 | /** |
91 | * iwl_commit_rxon - commit staging_rxon to hardware | 94 | * iwl_commit_rxon - commit staging_rxon to hardware |
92 | * | 95 | * |
@@ -95,21 +98,22 @@ MODULE_ALIAS("iwl4965"); | |||
95 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 98 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
96 | * a HW tune is required based on the RXON structure changes. | 99 | * a HW tune is required based on the RXON structure changes. |
97 | */ | 100 | */ |
98 | int iwl_commit_rxon(struct iwl_priv *priv) | 101 | int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
99 | { | 102 | { |
100 | /* cast away the const for active_rxon in this function */ | 103 | /* cast away the const for active_rxon in this function */ |
101 | struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 104 | struct iwl_rxon_cmd *active_rxon = (void *)&ctx->active; |
102 | int ret; | 105 | int ret; |
103 | bool new_assoc = | 106 | bool new_assoc = |
104 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); | 107 | !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); |
108 | bool old_assoc = !!(ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK); | ||
105 | 109 | ||
106 | if (!iwl_is_alive(priv)) | 110 | if (!iwl_is_alive(priv)) |
107 | return -EBUSY; | 111 | return -EBUSY; |
108 | 112 | ||
109 | /* always get timestamp with Rx frame */ | 113 | /* always get timestamp with Rx frame */ |
110 | priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK; | 114 | ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; |
111 | 115 | ||
112 | ret = iwl_check_rxon_cmd(priv); | 116 | ret = iwl_check_rxon_cmd(priv, ctx); |
113 | if (ret) { | 117 | if (ret) { |
114 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | 118 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); |
115 | return -EINVAL; | 119 | return -EINVAL; |
@@ -120,7 +124,7 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
120 | * abort any previous channel switch if still in process | 124 | * abort any previous channel switch if still in process |
121 | */ | 125 | */ |
122 | if (priv->switch_rxon.switch_in_progress && | 126 | if (priv->switch_rxon.switch_in_progress && |
123 | (priv->switch_rxon.channel != priv->staging_rxon.channel)) { | 127 | (priv->switch_rxon.channel != ctx->staging.channel)) { |
124 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", | 128 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", |
125 | le16_to_cpu(priv->switch_rxon.channel)); | 129 | le16_to_cpu(priv->switch_rxon.channel)); |
126 | iwl_chswitch_done(priv, false); | 130 | iwl_chswitch_done(priv, false); |
@@ -129,15 +133,15 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
129 | /* If we don't need to send a full RXON, we can use | 133 | /* If we don't need to send a full RXON, we can use |
130 | * iwl_rxon_assoc_cmd which is used to reconfigure filter | 134 | * iwl_rxon_assoc_cmd which is used to reconfigure filter |
131 | * and other flags for the current radio configuration. */ | 135 | * and other flags for the current radio configuration. */ |
132 | if (!iwl_full_rxon_required(priv)) { | 136 | if (!iwl_full_rxon_required(priv, ctx)) { |
133 | ret = iwl_send_rxon_assoc(priv); | 137 | ret = iwl_send_rxon_assoc(priv, ctx); |
134 | if (ret) { | 138 | if (ret) { |
135 | IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); | 139 | IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); |
136 | return ret; | 140 | return ret; |
137 | } | 141 | } |
138 | 142 | ||
139 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 143 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
140 | iwl_print_rx_config_cmd(priv); | 144 | iwl_print_rx_config_cmd(priv, ctx); |
141 | return 0; | 145 | return 0; |
142 | } | 146 | } |
143 | 147 | ||
@@ -145,13 +149,13 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
145 | * an RXON_ASSOC and the new config wants the associated mask enabled, | 149 | * an RXON_ASSOC and the new config wants the associated mask enabled, |
146 | * we must clear the associated from the active configuration | 150 | * we must clear the associated from the active configuration |
147 | * before we apply the new config */ | 151 | * before we apply the new config */ |
148 | if (iwl_is_associated(priv) && new_assoc) { | 152 | if (iwl_is_associated_ctx(ctx) && new_assoc) { |
149 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | 153 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); |
150 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 154 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
151 | 155 | ||
152 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON, | 156 | ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, |
153 | sizeof(struct iwl_rxon_cmd), | 157 | sizeof(struct iwl_rxon_cmd), |
154 | &priv->active_rxon); | 158 | active_rxon); |
155 | 159 | ||
156 | /* If the mask clearing failed then we set | 160 | /* If the mask clearing failed then we set |
157 | * active_rxon back to what it was previously */ | 161 | * active_rxon back to what it was previously */ |
@@ -160,9 +164,9 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
160 | IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); | 164 | IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); |
161 | return ret; | 165 | return ret; |
162 | } | 166 | } |
163 | iwl_clear_ucode_stations(priv); | 167 | iwl_clear_ucode_stations(priv, ctx); |
164 | iwl_restore_stations(priv); | 168 | iwl_restore_stations(priv, ctx); |
165 | ret = iwl_restore_default_wep_keys(priv); | 169 | ret = iwl_restore_default_wep_keys(priv, ctx); |
166 | if (ret) { | 170 | if (ret) { |
167 | IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); | 171 | IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); |
168 | return ret; | 172 | return ret; |
@@ -174,27 +178,46 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
174 | "* channel = %d\n" | 178 | "* channel = %d\n" |
175 | "* bssid = %pM\n", | 179 | "* bssid = %pM\n", |
176 | (new_assoc ? "" : "out"), | 180 | (new_assoc ? "" : "out"), |
177 | le16_to_cpu(priv->staging_rxon.channel), | 181 | le16_to_cpu(ctx->staging.channel), |
178 | priv->staging_rxon.bssid_addr); | 182 | ctx->staging.bssid_addr); |
183 | |||
184 | iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto); | ||
185 | |||
186 | if (!old_assoc) { | ||
187 | /* | ||
188 | * First of all, before setting associated, we need to | ||
189 | * send RXON timing so the device knows about the DTIM | ||
190 | * period and other timing values | ||
191 | */ | ||
192 | ret = iwl_send_rxon_timing(priv, ctx); | ||
193 | if (ret) { | ||
194 | IWL_ERR(priv, "Error setting RXON timing!\n"); | ||
195 | return ret; | ||
196 | } | ||
197 | } | ||
179 | 198 | ||
180 | iwl_set_rxon_hwcrypto(priv, !priv->cfg->mod_params->sw_crypto); | 199 | if (priv->cfg->ops->hcmd->set_pan_params) { |
200 | ret = priv->cfg->ops->hcmd->set_pan_params(priv); | ||
201 | if (ret) | ||
202 | return ret; | ||
203 | } | ||
181 | 204 | ||
182 | /* Apply the new configuration | 205 | /* Apply the new configuration |
183 | * RXON unassoc clears the station table in uCode so restoration of | 206 | * RXON unassoc clears the station table in uCode so restoration of |
184 | * stations is needed after it (the RXON command) completes | 207 | * stations is needed after it (the RXON command) completes |
185 | */ | 208 | */ |
186 | if (!new_assoc) { | 209 | if (!new_assoc) { |
187 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON, | 210 | ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, |
188 | sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); | 211 | sizeof(struct iwl_rxon_cmd), &ctx->staging); |
189 | if (ret) { | 212 | if (ret) { |
190 | IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); | 213 | IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); |
191 | return ret; | 214 | return ret; |
192 | } | 215 | } |
193 | IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); | 216 | IWL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); |
194 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 217 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
195 | iwl_clear_ucode_stations(priv); | 218 | iwl_clear_ucode_stations(priv, ctx); |
196 | iwl_restore_stations(priv); | 219 | iwl_restore_stations(priv, ctx); |
197 | ret = iwl_restore_default_wep_keys(priv); | 220 | ret = iwl_restore_default_wep_keys(priv, ctx); |
198 | if (ret) { | 221 | if (ret) { |
199 | IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); | 222 | IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); |
200 | return ret; | 223 | return ret; |
@@ -206,15 +229,15 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
206 | /* Apply the new configuration | 229 | /* Apply the new configuration |
207 | * RXON assoc doesn't clear the station table in uCode, | 230 | * RXON assoc doesn't clear the station table in uCode, |
208 | */ | 231 | */ |
209 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON, | 232 | ret = iwl_send_cmd_pdu(priv, ctx->rxon_cmd, |
210 | sizeof(struct iwl_rxon_cmd), &priv->staging_rxon); | 233 | sizeof(struct iwl_rxon_cmd), &ctx->staging); |
211 | if (ret) { | 234 | if (ret) { |
212 | IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); | 235 | IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); |
213 | return ret; | 236 | return ret; |
214 | } | 237 | } |
215 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 238 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
216 | } | 239 | } |
217 | iwl_print_rx_config_cmd(priv); | 240 | iwl_print_rx_config_cmd(priv, ctx); |
218 | 241 | ||
219 | iwl_init_sensitivity(priv); | 242 | iwl_init_sensitivity(priv); |
220 | 243 | ||
@@ -231,10 +254,14 @@ int iwl_commit_rxon(struct iwl_priv *priv) | |||
231 | 254 | ||
232 | void iwl_update_chain_flags(struct iwl_priv *priv) | 255 | void iwl_update_chain_flags(struct iwl_priv *priv) |
233 | { | 256 | { |
257 | struct iwl_rxon_context *ctx; | ||
234 | 258 | ||
235 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 259 | if (priv->cfg->ops->hcmd->set_rxon_chain) { |
236 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 260 | for_each_context(priv, ctx) { |
237 | iwlcore_commit_rxon(priv); | 261 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
262 | iwlcore_commit_rxon(priv, ctx); | ||
263 | } | ||
264 | } | ||
238 | } | 265 | } |
239 | 266 | ||
240 | static void iwl_clear_free_frames(struct iwl_priv *priv) | 267 | static void iwl_clear_free_frames(struct iwl_priv *priv) |
@@ -338,6 +365,13 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
338 | * beacon contents. | 365 | * beacon contents. |
339 | */ | 366 | */ |
340 | 367 | ||
368 | lockdep_assert_held(&priv->mutex); | ||
369 | |||
370 | if (!priv->beacon_ctx) { | ||
371 | IWL_ERR(priv, "trying to build beacon w/o beacon context!\n"); | ||
372 | return -EINVAL; | ||
373 | } | ||
374 | |||
341 | /* Initialize memory */ | 375 | /* Initialize memory */ |
342 | tx_beacon_cmd = &frame->u.beacon; | 376 | tx_beacon_cmd = &frame->u.beacon; |
343 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | 377 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); |
@@ -350,7 +384,7 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
350 | 384 | ||
351 | /* Set up TX command fields */ | 385 | /* Set up TX command fields */ |
352 | tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); | 386 | tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); |
353 | tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; | 387 | tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id; |
354 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 388 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
355 | tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | | 389 | tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | |
356 | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; | 390 | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; |
@@ -360,7 +394,7 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
360 | frame_size); | 394 | frame_size); |
361 | 395 | ||
362 | /* Set up packet rate and flags */ | 396 | /* Set up packet rate and flags */ |
363 | rate = iwl_rate_get_lowest_plcp(priv); | 397 | rate = iwl_rate_get_lowest_plcp(priv, priv->beacon_ctx); |
364 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, | 398 | priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, |
365 | priv->hw_params.valid_tx_ant); | 399 | priv->hw_params.valid_tx_ant); |
366 | rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant); | 400 | rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant); |
@@ -593,23 +627,84 @@ static void iwl_bg_beacon_update(struct work_struct *work) | |||
593 | container_of(work, struct iwl_priv, beacon_update); | 627 | container_of(work, struct iwl_priv, beacon_update); |
594 | struct sk_buff *beacon; | 628 | struct sk_buff *beacon; |
595 | 629 | ||
596 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 630 | mutex_lock(&priv->mutex); |
597 | beacon = ieee80211_beacon_get(priv->hw, priv->vif); | 631 | if (!priv->beacon_ctx) { |
632 | IWL_ERR(priv, "updating beacon w/o beacon context!\n"); | ||
633 | goto out; | ||
634 | } | ||
635 | |||
636 | if (priv->beacon_ctx->vif->type != NL80211_IFTYPE_AP) { | ||
637 | /* | ||
638 | * The ucode will send beacon notifications even in | ||
639 | * IBSS mode, but we don't want to process them. But | ||
640 | * we need to defer the type check to here due to | ||
641 | * requiring locking around the beacon_ctx access. | ||
642 | */ | ||
643 | goto out; | ||
644 | } | ||
598 | 645 | ||
646 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | ||
647 | beacon = ieee80211_beacon_get(priv->hw, priv->beacon_ctx->vif); | ||
599 | if (!beacon) { | 648 | if (!beacon) { |
600 | IWL_ERR(priv, "update beacon failed\n"); | 649 | IWL_ERR(priv, "update beacon failed\n"); |
601 | return; | 650 | goto out; |
602 | } | 651 | } |
603 | 652 | ||
604 | mutex_lock(&priv->mutex); | ||
605 | /* new beacon skb is allocated every time; dispose previous.*/ | 653 | /* new beacon skb is allocated every time; dispose previous.*/ |
606 | if (priv->ibss_beacon) | 654 | if (priv->ibss_beacon) |
607 | dev_kfree_skb(priv->ibss_beacon); | 655 | dev_kfree_skb(priv->ibss_beacon); |
608 | 656 | ||
609 | priv->ibss_beacon = beacon; | 657 | priv->ibss_beacon = beacon; |
610 | mutex_unlock(&priv->mutex); | ||
611 | 658 | ||
612 | iwl_send_beacon_cmd(priv); | 659 | iwl_send_beacon_cmd(priv); |
660 | out: | ||
661 | mutex_unlock(&priv->mutex); | ||
662 | } | ||
663 | |||
664 | static void iwl_bg_bt_runtime_config(struct work_struct *work) | ||
665 | { | ||
666 | struct iwl_priv *priv = | ||
667 | container_of(work, struct iwl_priv, bt_runtime_config); | ||
668 | |||
669 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
670 | return; | ||
671 | |||
672 | /* dont send host command if rf-kill is on */ | ||
673 | if (!iwl_is_ready_rf(priv)) | ||
674 | return; | ||
675 | priv->cfg->ops->hcmd->send_bt_config(priv); | ||
676 | } | ||
677 | |||
678 | static void iwl_bg_bt_full_concurrency(struct work_struct *work) | ||
679 | { | ||
680 | struct iwl_priv *priv = | ||
681 | container_of(work, struct iwl_priv, bt_full_concurrency); | ||
682 | struct iwl_rxon_context *ctx; | ||
683 | |||
684 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
685 | return; | ||
686 | |||
687 | /* dont send host command if rf-kill is on */ | ||
688 | if (!iwl_is_ready_rf(priv)) | ||
689 | return; | ||
690 | |||
691 | IWL_DEBUG_INFO(priv, "BT coex in %s mode\n", | ||
692 | priv->bt_full_concurrent ? | ||
693 | "full concurrency" : "3-wire"); | ||
694 | |||
695 | /* | ||
696 | * LQ & RXON updated cmds must be sent before BT Config cmd | ||
697 | * to avoid 3-wire collisions | ||
698 | */ | ||
699 | mutex_lock(&priv->mutex); | ||
700 | for_each_context(priv, ctx) { | ||
701 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
702 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | ||
703 | iwlcore_commit_rxon(priv, ctx); | ||
704 | } | ||
705 | mutex_unlock(&priv->mutex); | ||
706 | |||
707 | priv->cfg->ops->hcmd->send_bt_config(priv); | ||
613 | } | 708 | } |
614 | 709 | ||
615 | /** | 710 | /** |
@@ -781,8 +876,7 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv, | |||
781 | 876 | ||
782 | priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); | 877 | priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); |
783 | 878 | ||
784 | if ((priv->iw_mode == NL80211_IFTYPE_AP) && | 879 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) |
785 | (!test_bit(STATUS_EXIT_PENDING, &priv->status))) | ||
786 | queue_work(priv->workqueue, &priv->beacon_update); | 880 | queue_work(priv->workqueue, &priv->beacon_update); |
787 | } | 881 | } |
788 | 882 | ||
@@ -1653,6 +1747,7 @@ static void iwl_nic_start(struct iwl_priv *priv) | |||
1653 | struct iwlagn_ucode_capabilities { | 1747 | struct iwlagn_ucode_capabilities { |
1654 | u32 max_probe_length; | 1748 | u32 max_probe_length; |
1655 | u32 standard_phy_calibration_size; | 1749 | u32 standard_phy_calibration_size; |
1750 | bool pan; | ||
1656 | }; | 1751 | }; |
1657 | 1752 | ||
1658 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); | 1753 | static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); |
@@ -1890,6 +1985,11 @@ static int iwlagn_load_firmware(struct iwl_priv *priv, | |||
1890 | capa->max_probe_length = | 1985 | capa->max_probe_length = |
1891 | le32_to_cpup((__le32 *)tlv_data); | 1986 | le32_to_cpup((__le32 *)tlv_data); |
1892 | break; | 1987 | break; |
1988 | case IWL_UCODE_TLV_PAN: | ||
1989 | if (tlv_len) | ||
1990 | goto invalid_tlv_len; | ||
1991 | capa->pan = true; | ||
1992 | break; | ||
1893 | case IWL_UCODE_TLV_INIT_EVTLOG_PTR: | 1993 | case IWL_UCODE_TLV_INIT_EVTLOG_PTR: |
1894 | if (tlv_len != sizeof(u32)) | 1994 | if (tlv_len != sizeof(u32)) |
1895 | goto invalid_tlv_len; | 1995 | goto invalid_tlv_len; |
@@ -2165,6 +2265,12 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
2165 | priv->_agn.inst_evtlog_size = priv->cfg->max_event_log_size; | 2265 | priv->_agn.inst_evtlog_size = priv->cfg->max_event_log_size; |
2166 | priv->_agn.inst_errlog_ptr = pieces.inst_errlog_ptr; | 2266 | priv->_agn.inst_errlog_ptr = pieces.inst_errlog_ptr; |
2167 | 2267 | ||
2268 | if (ucode_capa.pan) { | ||
2269 | priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN); | ||
2270 | priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; | ||
2271 | } else | ||
2272 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | ||
2273 | |||
2168 | /* Copy images into buffers for card's bus-master reads ... */ | 2274 | /* Copy images into buffers for card's bus-master reads ... */ |
2169 | 2275 | ||
2170 | /* Runtime instructions (first block of data in file) */ | 2276 | /* Runtime instructions (first block of data in file) */ |
@@ -2563,6 +2669,9 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
2563 | return pos; | 2669 | return pos; |
2564 | } | 2670 | } |
2565 | 2671 | ||
2672 | /* enable/disable bt channel announcement */ | ||
2673 | priv->bt_ch_announce = iwlagn_bt_ch_announce; | ||
2674 | |||
2566 | #ifdef CONFIG_IWLWIFI_DEBUG | 2675 | #ifdef CONFIG_IWLWIFI_DEBUG |
2567 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) | 2676 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
2568 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | 2677 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) |
@@ -2663,6 +2772,7 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv) | |||
2663 | static void iwl_alive_start(struct iwl_priv *priv) | 2772 | static void iwl_alive_start(struct iwl_priv *priv) |
2664 | { | 2773 | { |
2665 | int ret = 0; | 2774 | int ret = 0; |
2775 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
2666 | 2776 | ||
2667 | IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 2777 | IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); |
2668 | 2778 | ||
@@ -2711,27 +2821,31 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
2711 | if (priv->cfg->ops->hcmd->set_tx_ant) | 2821 | if (priv->cfg->ops->hcmd->set_tx_ant) |
2712 | priv->cfg->ops->hcmd->set_tx_ant(priv, priv->cfg->valid_tx_ant); | 2822 | priv->cfg->ops->hcmd->set_tx_ant(priv, priv->cfg->valid_tx_ant); |
2713 | 2823 | ||
2714 | if (iwl_is_associated(priv)) { | 2824 | if (iwl_is_associated_ctx(ctx)) { |
2715 | struct iwl_rxon_cmd *active_rxon = | 2825 | struct iwl_rxon_cmd *active_rxon = |
2716 | (struct iwl_rxon_cmd *)&priv->active_rxon; | 2826 | (struct iwl_rxon_cmd *)&ctx->active; |
2717 | /* apply any changes in staging */ | 2827 | /* apply any changes in staging */ |
2718 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2828 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2719 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2829 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2720 | } else { | 2830 | } else { |
2831 | struct iwl_rxon_context *tmp; | ||
2721 | /* Initialize our rx_config data */ | 2832 | /* Initialize our rx_config data */ |
2722 | iwl_connection_init_rx_config(priv, NULL); | 2833 | for_each_context(priv, tmp) |
2834 | iwl_connection_init_rx_config(priv, tmp); | ||
2723 | 2835 | ||
2724 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2836 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2725 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2837 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
2726 | } | 2838 | } |
2727 | 2839 | ||
2728 | /* Configure Bluetooth device coexistence support */ | 2840 | if (!priv->cfg->advanced_bt_coexist) { |
2729 | priv->cfg->ops->hcmd->send_bt_config(priv); | 2841 | /* Configure Bluetooth device coexistence support */ |
2842 | priv->cfg->ops->hcmd->send_bt_config(priv); | ||
2843 | } | ||
2730 | 2844 | ||
2731 | iwl_reset_run_time_calib(priv); | 2845 | iwl_reset_run_time_calib(priv); |
2732 | 2846 | ||
2733 | /* Configure the adapter for unassociated operation */ | 2847 | /* Configure the adapter for unassociated operation */ |
2734 | iwlcore_commit_rxon(priv); | 2848 | iwlcore_commit_rxon(priv, ctx); |
2735 | 2849 | ||
2736 | /* At this point, the NIC is initialized and operational */ | 2850 | /* At this point, the NIC is initialized and operational */ |
2737 | iwl_rf_kill_ct_config(priv); | 2851 | iwl_rf_kill_ct_config(priv); |
@@ -2764,10 +2878,22 @@ static void __iwl_down(struct iwl_priv *priv) | |||
2764 | if (!exit_pending) | 2878 | if (!exit_pending) |
2765 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2879 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2766 | 2880 | ||
2767 | iwl_clear_ucode_stations(priv); | 2881 | /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set |
2768 | iwl_dealloc_bcast_station(priv); | 2882 | * to prevent rearm timer */ |
2883 | if (priv->cfg->ops->lib->recover_from_tx_stall) | ||
2884 | del_timer_sync(&priv->monitor_recover); | ||
2885 | |||
2886 | iwl_clear_ucode_stations(priv, NULL); | ||
2887 | iwl_dealloc_bcast_stations(priv); | ||
2769 | iwl_clear_driver_stations(priv); | 2888 | iwl_clear_driver_stations(priv); |
2770 | 2889 | ||
2890 | /* reset BT coex data */ | ||
2891 | priv->bt_status = 0; | ||
2892 | priv->bt_traffic_load = priv->cfg->bt_init_traffic_load; | ||
2893 | priv->bt_sco_active = false; | ||
2894 | priv->bt_full_concurrent = false; | ||
2895 | priv->bt_ci_compliance = 0; | ||
2896 | |||
2771 | /* Unblock any waiting calls */ | 2897 | /* Unblock any waiting calls */ |
2772 | wake_up_interruptible_all(&priv->wait_command_queue); | 2898 | wake_up_interruptible_all(&priv->wait_command_queue); |
2773 | 2899 | ||
@@ -2900,6 +3026,7 @@ static int iwl_prepare_card_hw(struct iwl_priv *priv) | |||
2900 | 3026 | ||
2901 | static int __iwl_up(struct iwl_priv *priv) | 3027 | static int __iwl_up(struct iwl_priv *priv) |
2902 | { | 3028 | { |
3029 | struct iwl_rxon_context *ctx; | ||
2903 | int i; | 3030 | int i; |
2904 | int ret; | 3031 | int ret; |
2905 | 3032 | ||
@@ -2913,9 +3040,13 @@ static int __iwl_up(struct iwl_priv *priv) | |||
2913 | return -EIO; | 3040 | return -EIO; |
2914 | } | 3041 | } |
2915 | 3042 | ||
2916 | ret = iwl_alloc_bcast_station(priv, true); | 3043 | for_each_context(priv, ctx) { |
2917 | if (ret) | 3044 | ret = iwl_alloc_bcast_station(priv, ctx, true); |
2918 | return ret; | 3045 | if (ret) { |
3046 | iwl_dealloc_bcast_stations(priv); | ||
3047 | return ret; | ||
3048 | } | ||
3049 | } | ||
2919 | 3050 | ||
2920 | iwl_prepare_card_hw(priv); | 3051 | iwl_prepare_card_hw(priv); |
2921 | 3052 | ||
@@ -2940,6 +3071,12 @@ static int __iwl_up(struct iwl_priv *priv) | |||
2940 | 3071 | ||
2941 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 3072 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
2942 | 3073 | ||
3074 | /* must be initialised before iwl_hw_nic_init */ | ||
3075 | if (priv->valid_contexts != BIT(IWL_RXON_CTX_BSS)) | ||
3076 | priv->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM; | ||
3077 | else | ||
3078 | priv->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; | ||
3079 | |||
2943 | ret = iwlagn_hw_nic_init(priv); | 3080 | ret = iwlagn_hw_nic_init(priv); |
2944 | if (ret) { | 3081 | if (ret) { |
2945 | IWL_ERR(priv, "Unable to init nic\n"); | 3082 | IWL_ERR(priv, "Unable to init nic\n"); |
@@ -3070,11 +3207,42 @@ static void iwl_bg_restart(struct work_struct *data) | |||
3070 | return; | 3207 | return; |
3071 | 3208 | ||
3072 | if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { | 3209 | if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { |
3210 | struct iwl_rxon_context *ctx; | ||
3211 | bool bt_sco, bt_full_concurrent; | ||
3212 | u8 bt_ci_compliance; | ||
3213 | u8 bt_load; | ||
3214 | u8 bt_status; | ||
3215 | |||
3073 | mutex_lock(&priv->mutex); | 3216 | mutex_lock(&priv->mutex); |
3074 | priv->vif = NULL; | 3217 | for_each_context(priv, ctx) |
3218 | ctx->vif = NULL; | ||
3075 | priv->is_open = 0; | 3219 | priv->is_open = 0; |
3220 | |||
3221 | /* | ||
3222 | * __iwl_down() will clear the BT status variables, | ||
3223 | * which is correct, but when we restart we really | ||
3224 | * want to keep them so restore them afterwards. | ||
3225 | * | ||
3226 | * The restart process will later pick them up and | ||
3227 | * re-configure the hw when we reconfigure the BT | ||
3228 | * command. | ||
3229 | */ | ||
3230 | bt_sco = priv->bt_sco_active; | ||
3231 | bt_full_concurrent = priv->bt_full_concurrent; | ||
3232 | bt_ci_compliance = priv->bt_ci_compliance; | ||
3233 | bt_load = priv->bt_traffic_load; | ||
3234 | bt_status = priv->bt_status; | ||
3235 | |||
3236 | __iwl_down(priv); | ||
3237 | |||
3238 | priv->bt_sco_active = bt_sco; | ||
3239 | priv->bt_full_concurrent = bt_full_concurrent; | ||
3240 | priv->bt_ci_compliance = bt_ci_compliance; | ||
3241 | priv->bt_traffic_load = bt_load; | ||
3242 | priv->bt_status = bt_status; | ||
3243 | |||
3076 | mutex_unlock(&priv->mutex); | 3244 | mutex_unlock(&priv->mutex); |
3077 | iwl_down(priv); | 3245 | iwl_cancel_deferred_work(priv); |
3078 | ieee80211_restart_hw(priv->hw); | 3246 | ieee80211_restart_hw(priv->hw); |
3079 | } else { | 3247 | } else { |
3080 | iwl_down(priv); | 3248 | iwl_down(priv); |
@@ -3105,12 +3273,15 @@ static void iwl_bg_rx_replenish(struct work_struct *data) | |||
3105 | 3273 | ||
3106 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) | 3274 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3107 | { | 3275 | { |
3276 | struct iwl_rxon_context *ctx; | ||
3108 | struct ieee80211_conf *conf = NULL; | 3277 | struct ieee80211_conf *conf = NULL; |
3109 | int ret = 0; | 3278 | int ret = 0; |
3110 | 3279 | ||
3111 | if (!vif || !priv->is_open) | 3280 | if (!vif || !priv->is_open) |
3112 | return; | 3281 | return; |
3113 | 3282 | ||
3283 | ctx = iwl_rxon_ctx_from_vif(vif); | ||
3284 | |||
3114 | if (vif->type == NL80211_IFTYPE_AP) { | 3285 | if (vif->type == NL80211_IFTYPE_AP) { |
3115 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); | 3286 | IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__); |
3116 | return; | 3287 | return; |
@@ -3123,42 +3294,42 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3123 | 3294 | ||
3124 | conf = ieee80211_get_hw_conf(priv->hw); | 3295 | conf = ieee80211_get_hw_conf(priv->hw); |
3125 | 3296 | ||
3126 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3297 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3127 | iwlcore_commit_rxon(priv); | 3298 | iwlcore_commit_rxon(priv, ctx); |
3128 | 3299 | ||
3129 | ret = iwl_send_rxon_timing(priv, vif); | 3300 | ret = iwl_send_rxon_timing(priv, ctx); |
3130 | if (ret) | 3301 | if (ret) |
3131 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 3302 | IWL_WARN(priv, "RXON timing - " |
3132 | "Attempting to continue.\n"); | 3303 | "Attempting to continue.\n"); |
3133 | 3304 | ||
3134 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3305 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3135 | 3306 | ||
3136 | iwl_set_rxon_ht(priv, &priv->current_ht_config); | 3307 | iwl_set_rxon_ht(priv, &priv->current_ht_config); |
3137 | 3308 | ||
3138 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3309 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
3139 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 3310 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
3140 | 3311 | ||
3141 | priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid); | 3312 | ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
3142 | 3313 | ||
3143 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 3314 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
3144 | vif->bss_conf.aid, vif->bss_conf.beacon_int); | 3315 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
3145 | 3316 | ||
3146 | if (vif->bss_conf.use_short_preamble) | 3317 | if (vif->bss_conf.use_short_preamble) |
3147 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 3318 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
3148 | else | 3319 | else |
3149 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3320 | ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3150 | 3321 | ||
3151 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3322 | if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { |
3152 | if (vif->bss_conf.use_short_slot) | 3323 | if (vif->bss_conf.use_short_slot) |
3153 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 3324 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
3154 | else | 3325 | else |
3155 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 3326 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
3156 | } | 3327 | } |
3157 | 3328 | ||
3158 | iwlcore_commit_rxon(priv); | 3329 | iwlcore_commit_rxon(priv, ctx); |
3159 | 3330 | ||
3160 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 3331 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", |
3161 | vif->bss_conf.aid, priv->active_rxon.bssid_addr); | 3332 | vif->bss_conf.aid, ctx->active.bssid_addr); |
3162 | 3333 | ||
3163 | switch (vif->type) { | 3334 | switch (vif->type) { |
3164 | case NL80211_IFTYPE_STATION: | 3335 | case NL80211_IFTYPE_STATION: |
@@ -3201,11 +3372,14 @@ static int iwl_mac_setup_register(struct iwl_priv *priv, | |||
3201 | { | 3372 | { |
3202 | int ret; | 3373 | int ret; |
3203 | struct ieee80211_hw *hw = priv->hw; | 3374 | struct ieee80211_hw *hw = priv->hw; |
3375 | struct iwl_rxon_context *ctx; | ||
3376 | |||
3204 | hw->rate_control_algorithm = "iwl-agn-rs"; | 3377 | hw->rate_control_algorithm = "iwl-agn-rs"; |
3205 | 3378 | ||
3206 | /* Tell mac80211 our characteristics */ | 3379 | /* Tell mac80211 our characteristics */ |
3207 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3380 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
3208 | IEEE80211_HW_AMPDU_AGGREGATION | | 3381 | IEEE80211_HW_AMPDU_AGGREGATION | |
3382 | IEEE80211_HW_NEED_DTIM_PERIOD | | ||
3209 | IEEE80211_HW_SPECTRUM_MGMT; | 3383 | IEEE80211_HW_SPECTRUM_MGMT; |
3210 | 3384 | ||
3211 | if (!priv->cfg->broken_powersave) | 3385 | if (!priv->cfg->broken_powersave) |
@@ -3219,9 +3393,10 @@ static int iwl_mac_setup_register(struct iwl_priv *priv, | |||
3219 | hw->sta_data_size = sizeof(struct iwl_station_priv); | 3393 | hw->sta_data_size = sizeof(struct iwl_station_priv); |
3220 | hw->vif_data_size = sizeof(struct iwl_vif_priv); | 3394 | hw->vif_data_size = sizeof(struct iwl_vif_priv); |
3221 | 3395 | ||
3222 | hw->wiphy->interface_modes = | 3396 | for_each_context(priv, ctx) { |
3223 | BIT(NL80211_IFTYPE_STATION) | | 3397 | hw->wiphy->interface_modes |= ctx->interface_modes; |
3224 | BIT(NL80211_IFTYPE_ADHOC); | 3398 | hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; |
3399 | } | ||
3225 | 3400 | ||
3226 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 3401 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | |
3227 | WIPHY_FLAG_DISABLE_BEACON_HINTS; | 3402 | WIPHY_FLAG_DISABLE_BEACON_HINTS; |
@@ -3349,22 +3524,25 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3349 | 3524 | ||
3350 | void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) | 3525 | void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3351 | { | 3526 | { |
3527 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | ||
3352 | int ret = 0; | 3528 | int ret = 0; |
3353 | 3529 | ||
3530 | lockdep_assert_held(&priv->mutex); | ||
3531 | |||
3354 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3532 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3355 | return; | 3533 | return; |
3356 | 3534 | ||
3357 | /* The following should be done only at AP bring up */ | 3535 | /* The following should be done only at AP bring up */ |
3358 | if (!iwl_is_associated(priv)) { | 3536 | if (!iwl_is_associated_ctx(ctx)) { |
3359 | 3537 | ||
3360 | /* RXON - unassoc (to set timing command) */ | 3538 | /* RXON - unassoc (to set timing command) */ |
3361 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3539 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3362 | iwlcore_commit_rxon(priv); | 3540 | iwlcore_commit_rxon(priv, ctx); |
3363 | 3541 | ||
3364 | /* RXON Timing */ | 3542 | /* RXON Timing */ |
3365 | ret = iwl_send_rxon_timing(priv, vif); | 3543 | ret = iwl_send_rxon_timing(priv, ctx); |
3366 | if (ret) | 3544 | if (ret) |
3367 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 3545 | IWL_WARN(priv, "RXON timing failed - " |
3368 | "Attempting to continue.\n"); | 3546 | "Attempting to continue.\n"); |
3369 | 3547 | ||
3370 | /* AP has all antennas */ | 3548 | /* AP has all antennas */ |
@@ -3372,28 +3550,30 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3372 | priv->hw_params.valid_rx_ant; | 3550 | priv->hw_params.valid_rx_ant; |
3373 | iwl_set_rxon_ht(priv, &priv->current_ht_config); | 3551 | iwl_set_rxon_ht(priv, &priv->current_ht_config); |
3374 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3552 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
3375 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 3553 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
3376 | 3554 | ||
3377 | priv->staging_rxon.assoc_id = 0; | 3555 | ctx->staging.assoc_id = 0; |
3378 | 3556 | ||
3379 | if (vif->bss_conf.use_short_preamble) | 3557 | if (vif->bss_conf.use_short_preamble) |
3380 | priv->staging_rxon.flags |= | 3558 | ctx->staging.flags |= |
3381 | RXON_FLG_SHORT_PREAMBLE_MSK; | 3559 | RXON_FLG_SHORT_PREAMBLE_MSK; |
3382 | else | 3560 | else |
3383 | priv->staging_rxon.flags &= | 3561 | ctx->staging.flags &= |
3384 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3562 | ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3385 | 3563 | ||
3386 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3564 | if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { |
3387 | if (vif->bss_conf.use_short_slot) | 3565 | if (vif->bss_conf.use_short_slot) |
3388 | priv->staging_rxon.flags |= | 3566 | ctx->staging.flags |= |
3389 | RXON_FLG_SHORT_SLOT_MSK; | 3567 | RXON_FLG_SHORT_SLOT_MSK; |
3390 | else | 3568 | else |
3391 | priv->staging_rxon.flags &= | 3569 | ctx->staging.flags &= |
3392 | ~RXON_FLG_SHORT_SLOT_MSK; | 3570 | ~RXON_FLG_SHORT_SLOT_MSK; |
3393 | } | 3571 | } |
3572 | /* need to send beacon cmd before committing assoc RXON! */ | ||
3573 | iwl_send_beacon_cmd(priv); | ||
3394 | /* restore RXON assoc */ | 3574 | /* restore RXON assoc */ |
3395 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3575 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3396 | iwlcore_commit_rxon(priv); | 3576 | iwlcore_commit_rxon(priv, ctx); |
3397 | } | 3577 | } |
3398 | iwl_send_beacon_cmd(priv); | 3578 | iwl_send_beacon_cmd(priv); |
3399 | 3579 | ||
@@ -3410,9 +3590,11 @@ static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
3410 | { | 3590 | { |
3411 | 3591 | ||
3412 | struct iwl_priv *priv = hw->priv; | 3592 | struct iwl_priv *priv = hw->priv; |
3593 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
3594 | |||
3413 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 3595 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
3414 | 3596 | ||
3415 | iwl_update_tkip_key(priv, keyconf, sta, | 3597 | iwl_update_tkip_key(priv, vif_priv->ctx, keyconf, sta, |
3416 | iv32, phase1key); | 3598 | iv32, phase1key); |
3417 | 3599 | ||
3418 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3600 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -3424,6 +3606,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3424 | struct ieee80211_key_conf *key) | 3606 | struct ieee80211_key_conf *key) |
3425 | { | 3607 | { |
3426 | struct iwl_priv *priv = hw->priv; | 3608 | struct iwl_priv *priv = hw->priv; |
3609 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
3610 | struct iwl_rxon_context *ctx = vif_priv->ctx; | ||
3427 | int ret; | 3611 | int ret; |
3428 | u8 sta_id; | 3612 | u8 sta_id; |
3429 | bool is_default_wep_key = false; | 3613 | bool is_default_wep_key = false; |
@@ -3435,7 +3619,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3435 | return -EOPNOTSUPP; | 3619 | return -EOPNOTSUPP; |
3436 | } | 3620 | } |
3437 | 3621 | ||
3438 | sta_id = iwl_sta_id_or_broadcast(priv, sta); | 3622 | sta_id = iwl_sta_id_or_broadcast(priv, vif_priv->ctx, sta); |
3439 | if (sta_id == IWL_INVALID_STATION) | 3623 | if (sta_id == IWL_INVALID_STATION) |
3440 | return -EINVAL; | 3624 | return -EINVAL; |
3441 | 3625 | ||
@@ -3452,7 +3636,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3452 | key->cipher == WLAN_CIPHER_SUITE_WEP104) && | 3636 | key->cipher == WLAN_CIPHER_SUITE_WEP104) && |
3453 | !sta) { | 3637 | !sta) { |
3454 | if (cmd == SET_KEY) | 3638 | if (cmd == SET_KEY) |
3455 | is_default_wep_key = !priv->key_mapping_key; | 3639 | is_default_wep_key = !ctx->key_mapping_keys; |
3456 | else | 3640 | else |
3457 | is_default_wep_key = | 3641 | is_default_wep_key = |
3458 | (key->hw_key_idx == HW_KEY_DEFAULT); | 3642 | (key->hw_key_idx == HW_KEY_DEFAULT); |
@@ -3461,17 +3645,18 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3461 | switch (cmd) { | 3645 | switch (cmd) { |
3462 | case SET_KEY: | 3646 | case SET_KEY: |
3463 | if (is_default_wep_key) | 3647 | if (is_default_wep_key) |
3464 | ret = iwl_set_default_wep_key(priv, key); | 3648 | ret = iwl_set_default_wep_key(priv, vif_priv->ctx, key); |
3465 | else | 3649 | else |
3466 | ret = iwl_set_dynamic_key(priv, key, sta_id); | 3650 | ret = iwl_set_dynamic_key(priv, vif_priv->ctx, |
3651 | key, sta_id); | ||
3467 | 3652 | ||
3468 | IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); | 3653 | IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); |
3469 | break; | 3654 | break; |
3470 | case DISABLE_KEY: | 3655 | case DISABLE_KEY: |
3471 | if (is_default_wep_key) | 3656 | if (is_default_wep_key) |
3472 | ret = iwl_remove_default_wep_key(priv, key); | 3657 | ret = iwl_remove_default_wep_key(priv, ctx, key); |
3473 | else | 3658 | else |
3474 | ret = iwl_remove_dynamic_key(priv, key, sta_id); | 3659 | ret = iwl_remove_dynamic_key(priv, ctx, key, sta_id); |
3475 | 3660 | ||
3476 | IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); | 3661 | IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); |
3477 | break; | 3662 | break; |
@@ -3540,8 +3725,8 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3540 | 3725 | ||
3541 | sta_priv->lq_sta.lq.general_params.flags &= | 3726 | sta_priv->lq_sta.lq.general_params.flags &= |
3542 | ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; | 3727 | ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; |
3543 | iwl_send_lq_cmd(priv, &sta_priv->lq_sta.lq, | 3728 | iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), |
3544 | CMD_ASYNC, false); | 3729 | &sta_priv->lq_sta.lq, CMD_ASYNC, false); |
3545 | } | 3730 | } |
3546 | break; | 3731 | break; |
3547 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 3732 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
@@ -3556,8 +3741,8 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
3556 | 3741 | ||
3557 | sta_priv->lq_sta.lq.general_params.flags |= | 3742 | sta_priv->lq_sta.lq.general_params.flags |= |
3558 | LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; | 3743 | LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; |
3559 | iwl_send_lq_cmd(priv, &sta_priv->lq_sta.lq, | 3744 | iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), |
3560 | CMD_ASYNC, false); | 3745 | &sta_priv->lq_sta.lq, CMD_ASYNC, false); |
3561 | } | 3746 | } |
3562 | ret = 0; | 3747 | ret = 0; |
3563 | break; | 3748 | break; |
@@ -3603,6 +3788,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3603 | { | 3788 | { |
3604 | struct iwl_priv *priv = hw->priv; | 3789 | struct iwl_priv *priv = hw->priv; |
3605 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; | 3790 | struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; |
3791 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
3606 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; | 3792 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3607 | int ret; | 3793 | int ret; |
3608 | u8 sta_id; | 3794 | u8 sta_id; |
@@ -3618,8 +3804,8 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3618 | if (vif->type == NL80211_IFTYPE_AP) | 3804 | if (vif->type == NL80211_IFTYPE_AP) |
3619 | sta_priv->client = true; | 3805 | sta_priv->client = true; |
3620 | 3806 | ||
3621 | ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, | 3807 | ret = iwl_add_station_common(priv, vif_priv->ctx, sta->addr, |
3622 | &sta_id); | 3808 | is_ap, sta, &sta_id); |
3623 | if (ret) { | 3809 | if (ret) { |
3624 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", | 3810 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", |
3625 | sta->addr, ret); | 3811 | sta->addr, ret); |
@@ -3647,6 +3833,15 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw, | |||
3647 | struct ieee80211_conf *conf = &hw->conf; | 3833 | struct ieee80211_conf *conf = &hw->conf; |
3648 | struct ieee80211_channel *channel = ch_switch->channel; | 3834 | struct ieee80211_channel *channel = ch_switch->channel; |
3649 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | 3835 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; |
3836 | /* | ||
3837 | * MULTI-FIXME | ||
3838 | * When we add support for multiple interfaces, we need to | ||
3839 | * revisit this. The channel switch command in the device | ||
3840 | * only affects the BSS context, but what does that really | ||
3841 | * mean? And what if we get a CSA on the second interface? | ||
3842 | * This needs a lot of work. | ||
3843 | */ | ||
3844 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3650 | u16 ch; | 3845 | u16 ch; |
3651 | unsigned long flags = 0; | 3846 | unsigned long flags = 0; |
3652 | 3847 | ||
@@ -3659,7 +3854,7 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw, | |||
3659 | test_bit(STATUS_SCANNING, &priv->status)) | 3854 | test_bit(STATUS_SCANNING, &priv->status)) |
3660 | goto out_exit; | 3855 | goto out_exit; |
3661 | 3856 | ||
3662 | if (!iwl_is_associated(priv)) | 3857 | if (!iwl_is_associated_ctx(ctx)) |
3663 | goto out_exit; | 3858 | goto out_exit; |
3664 | 3859 | ||
3665 | /* channel switch in progress */ | 3860 | /* channel switch in progress */ |
@@ -3670,7 +3865,7 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw, | |||
3670 | if (priv->cfg->ops->lib->set_channel_switch) { | 3865 | if (priv->cfg->ops->lib->set_channel_switch) { |
3671 | 3866 | ||
3672 | ch = channel->hw_value; | 3867 | ch = channel->hw_value; |
3673 | if (le16_to_cpu(priv->active_rxon.channel) != ch) { | 3868 | if (le16_to_cpu(ctx->active.channel) != ch) { |
3674 | ch_info = iwl_get_channel_info(priv, | 3869 | ch_info = iwl_get_channel_info(priv, |
3675 | channel->band, | 3870 | channel->band, |
3676 | ch); | 3871 | ch); |
@@ -3683,31 +3878,31 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw, | |||
3683 | priv->current_ht_config.smps = conf->smps_mode; | 3878 | priv->current_ht_config.smps = conf->smps_mode; |
3684 | 3879 | ||
3685 | /* Configure HT40 channels */ | 3880 | /* Configure HT40 channels */ |
3686 | ht_conf->is_ht = conf_is_ht(conf); | 3881 | ctx->ht.enabled = conf_is_ht(conf); |
3687 | if (ht_conf->is_ht) { | 3882 | if (ctx->ht.enabled) { |
3688 | if (conf_is_ht40_minus(conf)) { | 3883 | if (conf_is_ht40_minus(conf)) { |
3689 | ht_conf->extension_chan_offset = | 3884 | ctx->ht.extension_chan_offset = |
3690 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | 3885 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; |
3691 | ht_conf->is_40mhz = true; | 3886 | ctx->ht.is_40mhz = true; |
3692 | } else if (conf_is_ht40_plus(conf)) { | 3887 | } else if (conf_is_ht40_plus(conf)) { |
3693 | ht_conf->extension_chan_offset = | 3888 | ctx->ht.extension_chan_offset = |
3694 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | 3889 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; |
3695 | ht_conf->is_40mhz = true; | 3890 | ctx->ht.is_40mhz = true; |
3696 | } else { | 3891 | } else { |
3697 | ht_conf->extension_chan_offset = | 3892 | ctx->ht.extension_chan_offset = |
3698 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | 3893 | IEEE80211_HT_PARAM_CHA_SEC_NONE; |
3699 | ht_conf->is_40mhz = false; | 3894 | ctx->ht.is_40mhz = false; |
3700 | } | 3895 | } |
3701 | } else | 3896 | } else |
3702 | ht_conf->is_40mhz = false; | 3897 | ctx->ht.is_40mhz = false; |
3703 | 3898 | ||
3704 | if (le16_to_cpu(priv->staging_rxon.channel) != ch) | 3899 | if ((le16_to_cpu(ctx->staging.channel) != ch)) |
3705 | priv->staging_rxon.flags = 0; | 3900 | ctx->staging.flags = 0; |
3706 | 3901 | ||
3707 | iwl_set_rxon_channel(priv, channel); | 3902 | iwl_set_rxon_channel(priv, channel, ctx); |
3708 | iwl_set_rxon_ht(priv, ht_conf); | 3903 | iwl_set_rxon_ht(priv, ht_conf); |
3709 | iwl_set_flags_for_band(priv, channel->band, | 3904 | iwl_set_flags_for_band(priv, ctx, channel->band, |
3710 | priv->vif); | 3905 | ctx->vif); |
3711 | spin_unlock_irqrestore(&priv->lock, flags); | 3906 | spin_unlock_irqrestore(&priv->lock, flags); |
3712 | 3907 | ||
3713 | iwl_set_rate(priv); | 3908 | iwl_set_rate(priv); |
@@ -3724,7 +3919,7 @@ out: | |||
3724 | mutex_unlock(&priv->mutex); | 3919 | mutex_unlock(&priv->mutex); |
3725 | out_exit: | 3920 | out_exit: |
3726 | if (!priv->switch_rxon.switch_in_progress) | 3921 | if (!priv->switch_rxon.switch_in_progress) |
3727 | ieee80211_chswitch_done(priv->vif, false); | 3922 | ieee80211_chswitch_done(ctx->vif, false); |
3728 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3923 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
3729 | } | 3924 | } |
3730 | 3925 | ||
@@ -3735,6 +3930,7 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw, | |||
3735 | { | 3930 | { |
3736 | struct iwl_priv *priv = hw->priv; | 3931 | struct iwl_priv *priv = hw->priv; |
3737 | __le32 filter_or = 0, filter_nand = 0; | 3932 | __le32 filter_or = 0, filter_nand = 0; |
3933 | struct iwl_rxon_context *ctx; | ||
3738 | 3934 | ||
3739 | #define CHK(test, flag) do { \ | 3935 | #define CHK(test, flag) do { \ |
3740 | if (*total_flags & (test)) \ | 3936 | if (*total_flags & (test)) \ |
@@ -3754,10 +3950,11 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw, | |||
3754 | 3950 | ||
3755 | mutex_lock(&priv->mutex); | 3951 | mutex_lock(&priv->mutex); |
3756 | 3952 | ||
3757 | priv->staging_rxon.filter_flags &= ~filter_nand; | 3953 | for_each_context(priv, ctx) { |
3758 | priv->staging_rxon.filter_flags |= filter_or; | 3954 | ctx->staging.filter_flags &= ~filter_nand; |
3759 | 3955 | ctx->staging.filter_flags |= filter_or; | |
3760 | iwlcore_commit_rxon(priv); | 3956 | iwlcore_commit_rxon(priv, ctx); |
3957 | } | ||
3761 | 3958 | ||
3762 | mutex_unlock(&priv->mutex); | 3959 | mutex_unlock(&priv->mutex); |
3763 | 3960 | ||
@@ -3826,6 +4023,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
3826 | INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); | 4023 | INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); |
3827 | INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); | 4024 | INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); |
3828 | INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush); | 4025 | INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush); |
4026 | INIT_WORK(&priv->bt_full_concurrency, iwl_bg_bt_full_concurrency); | ||
4027 | INIT_WORK(&priv->bt_runtime_config, iwl_bg_bt_runtime_config); | ||
3829 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); | 4028 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); |
3830 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); | 4029 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); |
3831 | 4030 | ||
@@ -3868,10 +4067,10 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
3868 | cancel_delayed_work(&priv->alive_start); | 4067 | cancel_delayed_work(&priv->alive_start); |
3869 | cancel_work_sync(&priv->run_time_calib_work); | 4068 | cancel_work_sync(&priv->run_time_calib_work); |
3870 | cancel_work_sync(&priv->beacon_update); | 4069 | cancel_work_sync(&priv->beacon_update); |
4070 | cancel_work_sync(&priv->bt_full_concurrency); | ||
4071 | cancel_work_sync(&priv->bt_runtime_config); | ||
3871 | del_timer_sync(&priv->statistics_periodic); | 4072 | del_timer_sync(&priv->statistics_periodic); |
3872 | del_timer_sync(&priv->ucode_trace); | 4073 | del_timer_sync(&priv->ucode_trace); |
3873 | if (priv->cfg->ops->lib->recover_from_tx_stall) | ||
3874 | del_timer_sync(&priv->monitor_recover); | ||
3875 | } | 4074 | } |
3876 | 4075 | ||
3877 | static void iwl_init_hw_rates(struct iwl_priv *priv, | 4076 | static void iwl_init_hw_rates(struct iwl_priv *priv, |
@@ -3926,10 +4125,22 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3926 | 4125 | ||
3927 | /* Choose which receivers/antennas to use */ | 4126 | /* Choose which receivers/antennas to use */ |
3928 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 4127 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
3929 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 4128 | priv->cfg->ops->hcmd->set_rxon_chain(priv, |
4129 | &priv->contexts[IWL_RXON_CTX_BSS]); | ||
3930 | 4130 | ||
3931 | iwl_init_scan_params(priv); | 4131 | iwl_init_scan_params(priv); |
3932 | 4132 | ||
4133 | /* init bt coex */ | ||
4134 | if (priv->cfg->advanced_bt_coexist) { | ||
4135 | priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; | ||
4136 | priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; | ||
4137 | priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; | ||
4138 | priv->bt_on_thresh = BT_ON_THRESHOLD_DEF; | ||
4139 | priv->bt_duration = BT_DURATION_LIMIT_DEF; | ||
4140 | priv->dynamic_frag_thresh = BT_FRAG_THRESHOLD_DEF; | ||
4141 | priv->dynamic_agg_thresh = BT_AGG_THRESHOLD_DEF; | ||
4142 | } | ||
4143 | |||
3933 | /* Set the tx_power_user_lmt to the lowest power level | 4144 | /* Set the tx_power_user_lmt to the lowest power level |
3934 | * this value will get overwritten by channel max power avg | 4145 | * this value will get overwritten by channel max power avg |
3935 | * from eeprom */ | 4146 | * from eeprom */ |
@@ -4013,9 +4224,31 @@ static int iwl_set_hw_params(struct iwl_priv *priv) | |||
4013 | return priv->cfg->ops->lib->set_hw_params(priv); | 4224 | return priv->cfg->ops->lib->set_hw_params(priv); |
4014 | } | 4225 | } |
4015 | 4226 | ||
4227 | static const u8 iwlagn_bss_ac_to_fifo[] = { | ||
4228 | IWL_TX_FIFO_VO, | ||
4229 | IWL_TX_FIFO_VI, | ||
4230 | IWL_TX_FIFO_BE, | ||
4231 | IWL_TX_FIFO_BK, | ||
4232 | }; | ||
4233 | |||
4234 | static const u8 iwlagn_bss_ac_to_queue[] = { | ||
4235 | 0, 1, 2, 3, | ||
4236 | }; | ||
4237 | |||
4238 | static const u8 iwlagn_pan_ac_to_fifo[] = { | ||
4239 | IWL_TX_FIFO_VO_IPAN, | ||
4240 | IWL_TX_FIFO_VI_IPAN, | ||
4241 | IWL_TX_FIFO_BE_IPAN, | ||
4242 | IWL_TX_FIFO_BK_IPAN, | ||
4243 | }; | ||
4244 | |||
4245 | static const u8 iwlagn_pan_ac_to_queue[] = { | ||
4246 | 7, 6, 5, 4, | ||
4247 | }; | ||
4248 | |||
4016 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 4249 | static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
4017 | { | 4250 | { |
4018 | int err = 0; | 4251 | int err = 0, i; |
4019 | struct iwl_priv *priv; | 4252 | struct iwl_priv *priv; |
4020 | struct ieee80211_hw *hw; | 4253 | struct ieee80211_hw *hw; |
4021 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 4254 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
@@ -4043,6 +4276,51 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
4043 | priv = hw->priv; | 4276 | priv = hw->priv; |
4044 | /* At this point both hw and priv are allocated. */ | 4277 | /* At this point both hw and priv are allocated. */ |
4045 | 4278 | ||
4279 | /* | ||
4280 | * The default context is always valid, | ||
4281 | * more may be discovered when firmware | ||
4282 | * is loaded. | ||
4283 | */ | ||
4284 | priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); | ||
4285 | |||
4286 | for (i = 0; i < NUM_IWL_RXON_CTX; i++) | ||
4287 | priv->contexts[i].ctxid = i; | ||
4288 | |||
4289 | priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; | ||
4290 | priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; | ||
4291 | priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; | ||
4292 | priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; | ||
4293 | priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; | ||
4294 | priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; | ||
4295 | priv->contexts[IWL_RXON_CTX_BSS].ac_to_fifo = iwlagn_bss_ac_to_fifo; | ||
4296 | priv->contexts[IWL_RXON_CTX_BSS].ac_to_queue = iwlagn_bss_ac_to_queue; | ||
4297 | priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes = | ||
4298 | BIT(NL80211_IFTYPE_ADHOC); | ||
4299 | priv->contexts[IWL_RXON_CTX_BSS].interface_modes = | ||
4300 | BIT(NL80211_IFTYPE_STATION); | ||
4301 | priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; | ||
4302 | priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; | ||
4303 | priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; | ||
4304 | |||
4305 | priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON; | ||
4306 | priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd = REPLY_WIPAN_RXON_TIMING; | ||
4307 | priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd = REPLY_WIPAN_RXON_ASSOC; | ||
4308 | priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM; | ||
4309 | priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN; | ||
4310 | priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY; | ||
4311 | priv->contexts[IWL_RXON_CTX_PAN].bcast_sta_id = IWLAGN_PAN_BCAST_ID; | ||
4312 | priv->contexts[IWL_RXON_CTX_PAN].station_flags = STA_FLG_PAN_STATION; | ||
4313 | priv->contexts[IWL_RXON_CTX_PAN].ac_to_fifo = iwlagn_pan_ac_to_fifo; | ||
4314 | priv->contexts[IWL_RXON_CTX_PAN].ac_to_queue = iwlagn_pan_ac_to_queue; | ||
4315 | priv->contexts[IWL_RXON_CTX_PAN].mcast_queue = IWL_IPAN_MCAST_QUEUE; | ||
4316 | priv->contexts[IWL_RXON_CTX_PAN].interface_modes = | ||
4317 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP); | ||
4318 | priv->contexts[IWL_RXON_CTX_PAN].ap_devtype = RXON_DEV_TYPE_CP; | ||
4319 | priv->contexts[IWL_RXON_CTX_PAN].station_devtype = RXON_DEV_TYPE_2STA; | ||
4320 | priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P; | ||
4321 | |||
4322 | BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); | ||
4323 | |||
4046 | SET_IEEE80211_DEV(hw, &pdev->dev); | 4324 | SET_IEEE80211_DEV(hw, &pdev->dev); |
4047 | 4325 | ||
4048 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); | 4326 | IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); |
@@ -4050,6 +4328,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
4050 | priv->pci_dev = pdev; | 4328 | priv->pci_dev = pdev; |
4051 | priv->inta_mask = CSR_INI_SET_MASK; | 4329 | priv->inta_mask = CSR_INI_SET_MASK; |
4052 | 4330 | ||
4331 | /* is antenna coupling more than 35dB ? */ | ||
4332 | priv->bt_ant_couple_ok = | ||
4333 | (iwlagn_ant_coupling > IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? | ||
4334 | true : false; | ||
4335 | |||
4336 | /* enable/disable bt channel announcement */ | ||
4337 | priv->bt_ch_announce = iwlagn_bt_ch_announce; | ||
4338 | |||
4053 | if (iwl_alloc_traffic_mem(priv)) | 4339 | if (iwl_alloc_traffic_mem(priv)) |
4054 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); | 4340 | IWL_ERR(priv, "Not enough memory to generate traffic log\n"); |
4055 | 4341 | ||
@@ -4583,3 +4869,11 @@ module_param_named(ucode_alternative, iwlagn_wanted_ucode_alternative, int, | |||
4583 | S_IRUGO); | 4869 | S_IRUGO); |
4584 | MODULE_PARM_DESC(ucode_alternative, | 4870 | MODULE_PARM_DESC(ucode_alternative, |
4585 | "specify ucode alternative to use from ucode file"); | 4871 | "specify ucode alternative to use from ucode file"); |
4872 | |||
4873 | module_param_named(antenna_coupling, iwlagn_ant_coupling, int, S_IRUGO); | ||
4874 | MODULE_PARM_DESC(antenna_coupling, | ||
4875 | "specify antenna coupling in dB (defualt: 0 dB)"); | ||
4876 | |||
4877 | module_param_named(bt_ch_announce, iwlagn_bt_ch_announce, bool, S_IRUGO); | ||
4878 | MODULE_PARM_DESC(bt_ch_announce, | ||
4879 | "Enable BT channel announcement mode (default: enable)"); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index cc6464dc72e5..7c542a8c8f81 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -95,6 +95,7 @@ extern struct iwl_cfg iwl1000_bg_cfg; | |||
95 | 95 | ||
96 | extern struct iwl_mod_params iwlagn_mod_params; | 96 | extern struct iwl_mod_params iwlagn_mod_params; |
97 | extern struct iwl_hcmd_ops iwlagn_hcmd; | 97 | extern struct iwl_hcmd_ops iwlagn_hcmd; |
98 | extern struct iwl_hcmd_ops iwlagn_bt_hcmd; | ||
98 | extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils; | 99 | extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils; |
99 | 100 | ||
100 | int iwl_reset_ict(struct iwl_priv *priv); | 101 | int iwl_reset_ict(struct iwl_priv *priv); |
@@ -223,7 +224,16 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv, | |||
223 | struct ieee80211_vif *vif, bool add); | 224 | struct ieee80211_vif *vif, bool add); |
224 | 225 | ||
225 | /* hcmd */ | 226 | /* hcmd */ |
226 | int iwlagn_send_rxon_assoc(struct iwl_priv *priv); | 227 | int iwlagn_send_rxon_assoc(struct iwl_priv *priv, |
228 | struct iwl_rxon_context *ctx); | ||
227 | int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant); | 229 | int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant); |
228 | 230 | ||
231 | /* bt coex */ | ||
232 | void iwlagn_send_advance_bt_config(struct iwl_priv *priv); | ||
233 | void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, | ||
234 | struct iwl_rx_mem_buffer *rxb); | ||
235 | void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv); | ||
236 | void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv); | ||
237 | void iwlagn_bt_cancel_deferred_work(struct iwl_priv *priv); | ||
238 | |||
229 | #endif /* __iwl_agn_h__ */ | 239 | #endif /* __iwl_agn_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 4083e4430827..3e4ba31b5d59 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -62,7 +62,7 @@ | |||
62 | *****************************************************************************/ | 62 | *****************************************************************************/ |
63 | /* | 63 | /* |
64 | * Please use this file (iwl-commands.h) only for uCode API definitions. | 64 | * Please use this file (iwl-commands.h) only for uCode API definitions. |
65 | * Please use iwl-4965-hw.h for hardware-related definitions. | 65 | * Please use iwl-xxxx-hw.h for hardware-related definitions. |
66 | * Please use iwl-dev.h for driver implementation definitions. | 66 | * Please use iwl-dev.h for driver implementation definitions. |
67 | */ | 67 | */ |
68 | 68 | ||
@@ -173,6 +173,23 @@ enum { | |||
173 | REPLY_RX_MPDU_CMD = 0xc1, | 173 | REPLY_RX_MPDU_CMD = 0xc1, |
174 | REPLY_RX = 0xc3, | 174 | REPLY_RX = 0xc3, |
175 | REPLY_COMPRESSED_BA = 0xc5, | 175 | REPLY_COMPRESSED_BA = 0xc5, |
176 | |||
177 | /* BT Coex */ | ||
178 | REPLY_BT_COEX_PRIO_TABLE = 0xcc, | ||
179 | REPLY_BT_COEX_PROT_ENV = 0xcd, | ||
180 | REPLY_BT_COEX_PROFILE_NOTIF = 0xce, | ||
181 | REPLY_BT_COEX_SCO = 0xcf, | ||
182 | |||
183 | /* PAN commands */ | ||
184 | REPLY_WIPAN_PARAMS = 0xb2, | ||
185 | REPLY_WIPAN_RXON = 0xb3, /* use REPLY_RXON structure */ | ||
186 | REPLY_WIPAN_RXON_TIMING = 0xb4, /* use REPLY_RXON_TIMING structure */ | ||
187 | REPLY_WIPAN_RXON_ASSOC = 0xb6, /* use REPLY_RXON_ASSOC structure */ | ||
188 | REPLY_WIPAN_QOS_PARAM = 0xb7, /* use REPLY_QOS_PARAM structure */ | ||
189 | REPLY_WIPAN_WEPKEY = 0xb8, /* use REPLY_WEPKEY structure */ | ||
190 | REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9, | ||
191 | REPLY_WIPAN_NOA_NOTIFICATION = 0xbc, | ||
192 | |||
176 | REPLY_MAX = 0xff | 193 | REPLY_MAX = 0xff |
177 | }; | 194 | }; |
178 | 195 | ||
@@ -600,6 +617,9 @@ enum { | |||
600 | RXON_DEV_TYPE_ESS = 3, | 617 | RXON_DEV_TYPE_ESS = 3, |
601 | RXON_DEV_TYPE_IBSS = 4, | 618 | RXON_DEV_TYPE_IBSS = 4, |
602 | RXON_DEV_TYPE_SNIFFER = 6, | 619 | RXON_DEV_TYPE_SNIFFER = 6, |
620 | RXON_DEV_TYPE_CP = 7, | ||
621 | RXON_DEV_TYPE_2STA = 8, | ||
622 | RXON_DEV_TYPE_P2P = 9, | ||
603 | }; | 623 | }; |
604 | 624 | ||
605 | 625 | ||
@@ -816,7 +836,8 @@ struct iwl_rxon_time_cmd { | |||
816 | __le16 atim_window; | 836 | __le16 atim_window; |
817 | __le32 beacon_init_val; | 837 | __le32 beacon_init_val; |
818 | __le16 listen_interval; | 838 | __le16 listen_interval; |
819 | __le16 reserved; | 839 | u8 dtim_period; |
840 | u8 delta_cp_bss_tbtts; | ||
820 | } __packed; | 841 | } __packed; |
821 | 842 | ||
822 | /* | 843 | /* |
@@ -953,11 +974,13 @@ struct iwl_qosparam_cmd { | |||
953 | 974 | ||
954 | /* Special, dedicated locations within device's station table */ | 975 | /* Special, dedicated locations within device's station table */ |
955 | #define IWL_AP_ID 0 | 976 | #define IWL_AP_ID 0 |
977 | #define IWL_AP_ID_PAN 1 | ||
956 | #define IWL_STA_ID 2 | 978 | #define IWL_STA_ID 2 |
957 | #define IWL3945_BROADCAST_ID 24 | 979 | #define IWL3945_BROADCAST_ID 24 |
958 | #define IWL3945_STATION_COUNT 25 | 980 | #define IWL3945_STATION_COUNT 25 |
959 | #define IWL4965_BROADCAST_ID 31 | 981 | #define IWL4965_BROADCAST_ID 31 |
960 | #define IWL4965_STATION_COUNT 32 | 982 | #define IWL4965_STATION_COUNT 32 |
983 | #define IWLAGN_PAN_BCAST_ID 14 | ||
961 | #define IWLAGN_BROADCAST_ID 15 | 984 | #define IWLAGN_BROADCAST_ID 15 |
962 | #define IWLAGN_STATION_COUNT 16 | 985 | #define IWLAGN_STATION_COUNT 16 |
963 | 986 | ||
@@ -966,6 +989,7 @@ struct iwl_qosparam_cmd { | |||
966 | 989 | ||
967 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) | 990 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) |
968 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) | 991 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) |
992 | #define STA_FLG_PAN_STATION cpu_to_le32(1 << 13) | ||
969 | #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) | 993 | #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) |
970 | #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) | 994 | #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) |
971 | #define STA_FLG_MAX_AGG_SIZE_POS (19) | 995 | #define STA_FLG_MAX_AGG_SIZE_POS (19) |
@@ -994,6 +1018,7 @@ struct iwl_qosparam_cmd { | |||
994 | #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) | 1018 | #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) |
995 | #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) | 1019 | #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) |
996 | #define STA_KEY_MAX_NUM 8 | 1020 | #define STA_KEY_MAX_NUM 8 |
1021 | #define STA_KEY_MAX_NUM_PAN 16 | ||
997 | 1022 | ||
998 | /* Flags indicate whether to modify vs. don't change various station params */ | 1023 | /* Flags indicate whether to modify vs. don't change various station params */ |
999 | #define STA_MODIFY_KEY_MASK 0x01 | 1024 | #define STA_MODIFY_KEY_MASK 0x01 |
@@ -1056,7 +1081,8 @@ struct sta_id_modify { | |||
1056 | * | 1081 | * |
1057 | * The device contains an internal table of per-station information, | 1082 | * The device contains an internal table of per-station information, |
1058 | * with info on security keys, aggregation parameters, and Tx rates for | 1083 | * with info on security keys, aggregation parameters, and Tx rates for |
1059 | * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD, | 1084 | * initial Tx attempt and any retries (agn devices uses |
1085 | * REPLY_TX_LINK_QUALITY_CMD, | ||
1060 | * 3945 uses REPLY_RATE_SCALE to set up rate tables). | 1086 | * 3945 uses REPLY_RATE_SCALE to set up rate tables). |
1061 | * | 1087 | * |
1062 | * REPLY_ADD_STA sets up the table entry for one station, either creating | 1088 | * REPLY_ADD_STA sets up the table entry for one station, either creating |
@@ -1427,12 +1453,12 @@ struct iwl_rx_mpdu_res_start { | |||
1427 | * uCode handles all timing and protocol related to control frames | 1453 | * uCode handles all timing and protocol related to control frames |
1428 | * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler | 1454 | * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler |
1429 | * handle reception of block-acks; uCode updates the host driver via | 1455 | * handle reception of block-acks; uCode updates the host driver via |
1430 | * REPLY_COMPRESSED_BA (4965). | 1456 | * REPLY_COMPRESSED_BA. |
1431 | * | 1457 | * |
1432 | * uCode handles retrying Tx when an ACK is expected but not received. | 1458 | * uCode handles retrying Tx when an ACK is expected but not received. |
1433 | * This includes trying lower data rates than the one requested in the Tx | 1459 | * This includes trying lower data rates than the one requested in the Tx |
1434 | * command, as set up by the REPLY_RATE_SCALE (for 3945) or | 1460 | * command, as set up by the REPLY_RATE_SCALE (for 3945) or |
1435 | * REPLY_TX_LINK_QUALITY_CMD (4965). | 1461 | * REPLY_TX_LINK_QUALITY_CMD (agn). |
1436 | * | 1462 | * |
1437 | * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. | 1463 | * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. |
1438 | * This command must be executed after every RXON command, before Tx can occur. | 1464 | * This command must be executed after every RXON command, before Tx can occur. |
@@ -1468,7 +1494,7 @@ struct iwl_rx_mpdu_res_start { | |||
1468 | * Set this for unicast frames, but not broadcast/multicast. */ | 1494 | * Set this for unicast frames, but not broadcast/multicast. */ |
1469 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) | 1495 | #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) |
1470 | 1496 | ||
1471 | /* For 4965: | 1497 | /* For agn devices: |
1472 | * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). | 1498 | * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). |
1473 | * Tx command's initial_rate_index indicates first rate to try; | 1499 | * Tx command's initial_rate_index indicates first rate to try; |
1474 | * uCode walks through table for additional Tx attempts. | 1500 | * uCode walks through table for additional Tx attempts. |
@@ -1487,7 +1513,7 @@ struct iwl_rx_mpdu_res_start { | |||
1487 | */ | 1513 | */ |
1488 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) | 1514 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) |
1489 | 1515 | ||
1490 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. | 1516 | /* Tx antenna selection field; used only for 3945, reserved (0) for agn devices. |
1491 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ | 1517 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ |
1492 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) | 1518 | #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) |
1493 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) | 1519 | #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) |
@@ -1870,9 +1896,10 @@ enum { | |||
1870 | * frame in this new agg block failed in previous agg block(s). | 1896 | * frame in this new agg block failed in previous agg block(s). |
1871 | * | 1897 | * |
1872 | * Note that, for aggregation, ACK (block-ack) status is not delivered here; | 1898 | * Note that, for aggregation, ACK (block-ack) status is not delivered here; |
1873 | * block-ack has not been received by the time the 4965 records this status. | 1899 | * block-ack has not been received by the time the agn device records |
1900 | * this status. | ||
1874 | * This status relates to reasons the tx might have been blocked or aborted | 1901 | * This status relates to reasons the tx might have been blocked or aborted |
1875 | * within the sending station (this 4965), rather than whether it was | 1902 | * within the sending station (this agn device), rather than whether it was |
1876 | * received successfully by the destination station. | 1903 | * received successfully by the destination station. |
1877 | */ | 1904 | */ |
1878 | struct agg_tx_status { | 1905 | struct agg_tx_status { |
@@ -2140,14 +2167,16 @@ struct iwl_link_qual_agg_params { | |||
2140 | /* | 2167 | /* |
2141 | * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) | 2168 | * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) |
2142 | * | 2169 | * |
2143 | * For 4965 only; 3945 uses REPLY_RATE_SCALE. | 2170 | * For agn devices only; 3945 uses REPLY_RATE_SCALE. |
2144 | * | 2171 | * |
2145 | * Each station in the 4965's internal station table has its own table of 16 | 2172 | * Each station in the agn device's internal station table has its own table |
2173 | * of 16 | ||
2146 | * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when | 2174 | * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when |
2147 | * an ACK is not received. This command replaces the entire table for | 2175 | * an ACK is not received. This command replaces the entire table for |
2148 | * one station. | 2176 | * one station. |
2149 | * | 2177 | * |
2150 | * NOTE: Station must already be in 4965's station table. Use REPLY_ADD_STA. | 2178 | * NOTE: Station must already be in agn device's station table. |
2179 | * Use REPLY_ADD_STA. | ||
2151 | * | 2180 | * |
2152 | * The rate scaling procedures described below work well. Of course, other | 2181 | * The rate scaling procedures described below work well. Of course, other |
2153 | * procedures are possible, and may work better for particular environments. | 2182 | * procedures are possible, and may work better for particular environments. |
@@ -2184,12 +2213,12 @@ struct iwl_link_qual_agg_params { | |||
2184 | * | 2213 | * |
2185 | * ACCUMULATING HISTORY | 2214 | * ACCUMULATING HISTORY |
2186 | * | 2215 | * |
2187 | * The rate scaling algorithm for 4965, as implemented in Linux driver, uses | 2216 | * The rate scaling algorithm for agn devices, as implemented in Linux driver, |
2188 | * two sets of frame Tx success history: One for the current/active modulation | 2217 | * uses two sets of frame Tx success history: One for the current/active |
2189 | * mode, and one for a speculative/search mode that is being attempted. If the | 2218 | * modulation mode, and one for a speculative/search mode that is being |
2190 | * speculative mode turns out to be more effective (i.e. actual transfer | 2219 | * attempted. If the speculative mode turns out to be more effective (i.e. |
2191 | * rate is better), then the driver continues to use the speculative mode | 2220 | * actual transfer rate is better), then the driver continues to use the |
2192 | * as the new current active mode. | 2221 | * speculative mode as the new current active mode. |
2193 | * | 2222 | * |
2194 | * Each history set contains, separately for each possible rate, data for a | 2223 | * Each history set contains, separately for each possible rate, data for a |
2195 | * sliding window of the 62 most recent tx attempts at that rate. The data | 2224 | * sliding window of the 62 most recent tx attempts at that rate. The data |
@@ -2200,12 +2229,12 @@ struct iwl_link_qual_agg_params { | |||
2200 | * The driver uses the bit map to remove successes from the success sum, as | 2229 | * The driver uses the bit map to remove successes from the success sum, as |
2201 | * the oldest tx attempts fall out of the window. | 2230 | * the oldest tx attempts fall out of the window. |
2202 | * | 2231 | * |
2203 | * When the 4965 makes multiple tx attempts for a given frame, each attempt | 2232 | * When the agn device makes multiple tx attempts for a given frame, each |
2204 | * might be at a different rate, and have different modulation characteristics | 2233 | * attempt might be at a different rate, and have different modulation |
2205 | * (e.g. antenna, fat channel, short guard interval), as set up in the rate | 2234 | * characteristics (e.g. antenna, fat channel, short guard interval), as set |
2206 | * scaling table in the Link Quality command. The driver must determine | 2235 | * up in the rate scaling table in the Link Quality command. The driver must |
2207 | * which rate table entry was used for each tx attempt, to determine which | 2236 | * determine which rate table entry was used for each tx attempt, to determine |
2208 | * rate-specific history to update, and record only those attempts that | 2237 | * which rate-specific history to update, and record only those attempts that |
2209 | * match the modulation characteristics of the history set. | 2238 | * match the modulation characteristics of the history set. |
2210 | * | 2239 | * |
2211 | * When using block-ack (aggregation), all frames are transmitted at the same | 2240 | * When using block-ack (aggregation), all frames are transmitted at the same |
@@ -2335,7 +2364,7 @@ struct iwl_link_quality_cmd { | |||
2335 | /* | 2364 | /* |
2336 | * Rate info; when using rate-scaling, Tx command's initial_rate_index | 2365 | * Rate info; when using rate-scaling, Tx command's initial_rate_index |
2337 | * specifies 1st Tx rate attempted, via index into this table. | 2366 | * specifies 1st Tx rate attempted, via index into this table. |
2338 | * 4965 works its way through table when retrying Tx. | 2367 | * agn devices works its way through table when retrying Tx. |
2339 | */ | 2368 | */ |
2340 | struct { | 2369 | struct { |
2341 | __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ | 2370 | __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ |
@@ -2368,10 +2397,26 @@ struct iwl_link_quality_cmd { | |||
2368 | #define BT_MAX_KILL_DEF (0x5) | 2397 | #define BT_MAX_KILL_DEF (0x5) |
2369 | #define BT_MAX_KILL_MAX (0xFF) | 2398 | #define BT_MAX_KILL_MAX (0xFF) |
2370 | 2399 | ||
2400 | #define BT_DURATION_LIMIT_DEF 625 | ||
2401 | #define BT_DURATION_LIMIT_MAX 1250 | ||
2402 | #define BT_DURATION_LIMIT_MIN 625 | ||
2403 | |||
2404 | #define BT_ON_THRESHOLD_DEF 4 | ||
2405 | #define BT_ON_THRESHOLD_MAX 1000 | ||
2406 | #define BT_ON_THRESHOLD_MIN 1 | ||
2407 | |||
2408 | #define BT_FRAG_THRESHOLD_DEF 0 | ||
2409 | #define BT_FRAG_THRESHOLD_MAX 0 | ||
2410 | #define BT_FRAG_THRESHOLD_MIN 0 | ||
2411 | |||
2412 | #define BT_AGG_THRESHOLD_DEF 0 | ||
2413 | #define BT_AGG_THRESHOLD_MAX 0 | ||
2414 | #define BT_AGG_THRESHOLD_MIN 0 | ||
2415 | |||
2371 | /* | 2416 | /* |
2372 | * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) | 2417 | * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) |
2373 | * | 2418 | * |
2374 | * 3945 and 4965 support hardware handshake with Bluetooth device on | 2419 | * 3945 and agn devices support hardware handshake with Bluetooth device on |
2375 | * same platform. Bluetooth device alerts wireless device when it will Tx; | 2420 | * same platform. Bluetooth device alerts wireless device when it will Tx; |
2376 | * wireless device can delay or kill its own Tx to accommodate. | 2421 | * wireless device can delay or kill its own Tx to accommodate. |
2377 | */ | 2422 | */ |
@@ -2384,6 +2429,74 @@ struct iwl_bt_cmd { | |||
2384 | __le32 kill_cts_mask; | 2429 | __le32 kill_cts_mask; |
2385 | } __packed; | 2430 | } __packed; |
2386 | 2431 | ||
2432 | #define IWLAGN_BT_FLAG_CHANNEL_INHIBITION BIT(0) | ||
2433 | |||
2434 | #define IWLAGN_BT_FLAG_COEX_MODE_MASK (BIT(3)|BIT(4)|BIT(5)) | ||
2435 | #define IWLAGN_BT_FLAG_COEX_MODE_SHIFT 3 | ||
2436 | #define IWLAGN_BT_FLAG_COEX_MODE_DISABLED 0 | ||
2437 | #define IWLAGN_BT_FLAG_COEX_MODE_LEGACY_2W 1 | ||
2438 | #define IWLAGN_BT_FLAG_COEX_MODE_3W 2 | ||
2439 | #define IWLAGN_BT_FLAG_COEX_MODE_4W 3 | ||
2440 | |||
2441 | #define IWLAGN_BT_FLAG_UCODE_DEFAULT BIT(6) | ||
2442 | #define IWLAGN_BT_FLAG_NOCOEX_NOTIF BIT(7) | ||
2443 | |||
2444 | #define IWLAGN_BT_PRIO_BOOST_MAX 0xFF | ||
2445 | #define IWLAGN_BT_PRIO_BOOST_MIN 0x00 | ||
2446 | #define IWLAGN_BT_PRIO_BOOST_DEFAULT 0xF0 | ||
2447 | |||
2448 | #define IWLAGN_BT_MAX_KILL_DEFAULT 5 | ||
2449 | |||
2450 | #define IWLAGN_BT3_T7_DEFAULT 1 | ||
2451 | |||
2452 | #define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffffffff) | ||
2453 | #define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffffffff) | ||
2454 | |||
2455 | #define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2 | ||
2456 | |||
2457 | #define IWLAGN_BT3_T2_DEFAULT 0xc | ||
2458 | |||
2459 | #define IWLAGN_BT_VALID_ENABLE_FLAGS cpu_to_le16(BIT(0)) | ||
2460 | #define IWLAGN_BT_VALID_BOOST cpu_to_le16(BIT(1)) | ||
2461 | #define IWLAGN_BT_VALID_MAX_KILL cpu_to_le16(BIT(2)) | ||
2462 | #define IWLAGN_BT_VALID_3W_TIMERS cpu_to_le16(BIT(3)) | ||
2463 | #define IWLAGN_BT_VALID_KILL_ACK_MASK cpu_to_le16(BIT(4)) | ||
2464 | #define IWLAGN_BT_VALID_KILL_CTS_MASK cpu_to_le16(BIT(5)) | ||
2465 | #define IWLAGN_BT_VALID_BT4_TIMES cpu_to_le16(BIT(6)) | ||
2466 | #define IWLAGN_BT_VALID_3W_LUT cpu_to_le16(BIT(7)) | ||
2467 | |||
2468 | #define IWLAGN_BT_ALL_VALID_MSK (IWLAGN_BT_VALID_ENABLE_FLAGS | \ | ||
2469 | IWLAGN_BT_VALID_BOOST | \ | ||
2470 | IWLAGN_BT_VALID_MAX_KILL | \ | ||
2471 | IWLAGN_BT_VALID_3W_TIMERS | \ | ||
2472 | IWLAGN_BT_VALID_KILL_ACK_MASK | \ | ||
2473 | IWLAGN_BT_VALID_KILL_CTS_MASK | \ | ||
2474 | IWLAGN_BT_VALID_BT4_TIMES | \ | ||
2475 | IWLAGN_BT_VALID_3W_LUT) | ||
2476 | |||
2477 | struct iwlagn_bt_cmd { | ||
2478 | u8 flags; | ||
2479 | u8 ledtime; /* unused */ | ||
2480 | u8 max_kill; | ||
2481 | u8 bt3_timer_t7_value; | ||
2482 | __le32 kill_ack_mask; | ||
2483 | __le32 kill_cts_mask; | ||
2484 | u8 bt3_prio_sample_time; | ||
2485 | u8 bt3_timer_t2_value; | ||
2486 | __le16 bt4_reaction_time; /* unused */ | ||
2487 | __le32 bt3_lookup_table[12]; | ||
2488 | __le16 bt4_decision_time; /* unused */ | ||
2489 | __le16 valid; | ||
2490 | u8 prio_boost; | ||
2491 | u8 reserved[3]; | ||
2492 | }; | ||
2493 | |||
2494 | #define IWLAGN_BT_SCO_ACTIVE cpu_to_le32(BIT(0)) | ||
2495 | |||
2496 | struct iwlagn_bt_sco_cmd { | ||
2497 | __le32 flags; | ||
2498 | }; | ||
2499 | |||
2387 | /****************************************************************************** | 2500 | /****************************************************************************** |
2388 | * (6) | 2501 | * (6) |
2389 | * Spectrum Management (802.11h) Commands, Responses, Notifications: | 2502 | * Spectrum Management (802.11h) Commands, Responses, Notifications: |
@@ -2572,7 +2685,7 @@ struct iwl_powertable_cmd { | |||
2572 | 2685 | ||
2573 | /* | 2686 | /* |
2574 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) | 2687 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) |
2575 | * 3945 and 4965 identical. | 2688 | * all devices identical. |
2576 | */ | 2689 | */ |
2577 | struct iwl_sleep_notification { | 2690 | struct iwl_sleep_notification { |
2578 | u8 pm_sleep_mode; | 2691 | u8 pm_sleep_mode; |
@@ -2583,7 +2696,7 @@ struct iwl_sleep_notification { | |||
2583 | __le32 bcon_timer; | 2696 | __le32 bcon_timer; |
2584 | } __packed; | 2697 | } __packed; |
2585 | 2698 | ||
2586 | /* Sleep states. 3945 and 4965 identical. */ | 2699 | /* Sleep states. all devices identical. */ |
2587 | enum { | 2700 | enum { |
2588 | IWL_PM_NO_SLEEP = 0, | 2701 | IWL_PM_NO_SLEEP = 0, |
2589 | IWL_PM_SLP_MAC = 1, | 2702 | IWL_PM_SLP_MAC = 1, |
@@ -2892,6 +3005,12 @@ struct iwl_scanstart_notification { | |||
2892 | #define SCAN_OWNER_STATUS 0x1; | 3005 | #define SCAN_OWNER_STATUS 0x1; |
2893 | #define MEASURE_OWNER_STATUS 0x2; | 3006 | #define MEASURE_OWNER_STATUS 0x2; |
2894 | 3007 | ||
3008 | #define IWL_PROBE_STATUS_OK 0 | ||
3009 | #define IWL_PROBE_STATUS_TX_FAILED BIT(0) | ||
3010 | /* error statuses combined with TX_FAILED */ | ||
3011 | #define IWL_PROBE_STATUS_FAIL_TTL BIT(1) | ||
3012 | #define IWL_PROBE_STATUS_FAIL_BT BIT(2) | ||
3013 | |||
2895 | #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ | 3014 | #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ |
2896 | /* | 3015 | /* |
2897 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) | 3016 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) |
@@ -2899,7 +3018,8 @@ struct iwl_scanstart_notification { | |||
2899 | struct iwl_scanresults_notification { | 3018 | struct iwl_scanresults_notification { |
2900 | u8 channel; | 3019 | u8 channel; |
2901 | u8 band; | 3020 | u8 band; |
2902 | u8 reserved[2]; | 3021 | u8 probe_status; |
3022 | u8 num_probe_not_sent; /* not enough time to send */ | ||
2903 | __le32 tsf_low; | 3023 | __le32 tsf_low; |
2904 | __le32 tsf_high; | 3024 | __le32 tsf_high; |
2905 | __le32 statistics[NUMBER_OF_STATISTICS]; | 3025 | __le32 statistics[NUMBER_OF_STATISTICS]; |
@@ -2911,7 +3031,7 @@ struct iwl_scanresults_notification { | |||
2911 | struct iwl_scancomplete_notification { | 3031 | struct iwl_scancomplete_notification { |
2912 | u8 scanned_channels; | 3032 | u8 scanned_channels; |
2913 | u8 status; | 3033 | u8 status; |
2914 | u8 reserved; | 3034 | u8 bt_status; /* BT On/Off status */ |
2915 | u8 last_channel; | 3035 | u8 last_channel; |
2916 | __le32 tsf_low; | 3036 | __le32 tsf_low; |
2917 | __le32 tsf_high; | 3037 | __le32 tsf_high; |
@@ -3270,7 +3390,7 @@ struct statistics_general_bt { | |||
3270 | 3390 | ||
3271 | /* | 3391 | /* |
3272 | * REPLY_STATISTICS_CMD = 0x9c, | 3392 | * REPLY_STATISTICS_CMD = 0x9c, |
3273 | * 3945 and 4965 identical. | 3393 | * all devices identical. |
3274 | * | 3394 | * |
3275 | * This command triggers an immediate response containing uCode statistics. | 3395 | * This command triggers an immediate response containing uCode statistics. |
3276 | * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. | 3396 | * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. |
@@ -3608,7 +3728,7 @@ struct iwl_enhance_sensitivity_cmd { | |||
3608 | /** | 3728 | /** |
3609 | * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) | 3729 | * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) |
3610 | * | 3730 | * |
3611 | * This command sets the relative gains of 4965's 3 radio receiver chains. | 3731 | * This command sets the relative gains of agn device's 3 radio receiver chains. |
3612 | * | 3732 | * |
3613 | * After the first association, driver should accumulate signal and noise | 3733 | * After the first association, driver should accumulate signal and noise |
3614 | * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 | 3734 | * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 |
@@ -3965,6 +4085,201 @@ struct iwl_coex_event_resp { | |||
3965 | 4085 | ||
3966 | 4086 | ||
3967 | /****************************************************************************** | 4087 | /****************************************************************************** |
4088 | * Bluetooth Coexistence commands | ||
4089 | * | ||
4090 | *****************************************************************************/ | ||
4091 | |||
4092 | /* | ||
4093 | * BT Status notification | ||
4094 | * REPLY_BT_COEX_PROFILE_NOTIF = 0xce | ||
4095 | */ | ||
4096 | enum iwl_bt_coex_profile_traffic_load { | ||
4097 | IWL_BT_COEX_TRAFFIC_LOAD_NONE = 0, | ||
4098 | IWL_BT_COEX_TRAFFIC_LOAD_LOW = 1, | ||
4099 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 2, | ||
4100 | IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS = 3, | ||
4101 | /* | ||
4102 | * There are no more even though below is a u8, the | ||
4103 | * indication from the BT device only has two bits. | ||
4104 | */ | ||
4105 | }; | ||
4106 | |||
4107 | #define BT_UART_MSG_FRAME1MSGTYPE_POS (0) | ||
4108 | #define BT_UART_MSG_FRAME1MSGTYPE_MSK \ | ||
4109 | (0x7 << BT_UART_MSG_FRAME1MSGTYPE_POS) | ||
4110 | #define BT_UART_MSG_FRAME1SSN_POS (3) | ||
4111 | #define BT_UART_MSG_FRAME1SSN_MSK \ | ||
4112 | (0x3 << BT_UART_MSG_FRAME1SSN_POS) | ||
4113 | #define BT_UART_MSG_FRAME1UPDATEREQ_POS (5) | ||
4114 | #define BT_UART_MSG_FRAME1UPDATEREQ_MSK \ | ||
4115 | (0x1 << BT_UART_MSG_FRAME1UPDATEREQ_POS) | ||
4116 | #define BT_UART_MSG_FRAME1RESERVED_POS (6) | ||
4117 | #define BT_UART_MSG_FRAME1RESERVED_MSK \ | ||
4118 | (0x3 << BT_UART_MSG_FRAME1RESERVED_POS) | ||
4119 | |||
4120 | #define BT_UART_MSG_FRAME2OPENCONNECTIONS_POS (0) | ||
4121 | #define BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK \ | ||
4122 | (0x3 << BT_UART_MSG_FRAME2OPENCONNECTIONS_POS) | ||
4123 | #define BT_UART_MSG_FRAME2TRAFFICLOAD_POS (2) | ||
4124 | #define BT_UART_MSG_FRAME2TRAFFICLOAD_MSK \ | ||
4125 | (0x3 << BT_UART_MSG_FRAME2TRAFFICLOAD_POS) | ||
4126 | #define BT_UART_MSG_FRAME2CHLSEQN_POS (4) | ||
4127 | #define BT_UART_MSG_FRAME2CHLSEQN_MSK \ | ||
4128 | (0x1 << BT_UART_MSG_FRAME2CHLSEQN_POS) | ||
4129 | #define BT_UART_MSG_FRAME2INBAND_POS (5) | ||
4130 | #define BT_UART_MSG_FRAME2INBAND_MSK \ | ||
4131 | (0x1 << BT_UART_MSG_FRAME2INBAND_POS) | ||
4132 | #define BT_UART_MSG_FRAME2RESERVED_POS (6) | ||
4133 | #define BT_UART_MSG_FRAME2RESERVED_MSK \ | ||
4134 | (0x3 << BT_UART_MSG_FRAME2RESERVED_POS) | ||
4135 | |||
4136 | #define BT_UART_MSG_FRAME3SCOESCO_POS (0) | ||
4137 | #define BT_UART_MSG_FRAME3SCOESCO_MSK \ | ||
4138 | (0x1 << BT_UART_MSG_FRAME3SCOESCO_POS) | ||
4139 | #define BT_UART_MSG_FRAME3SNIFF_POS (1) | ||
4140 | #define BT_UART_MSG_FRAME3SNIFF_MSK \ | ||
4141 | (0x1 << BT_UART_MSG_FRAME3SNIFF_POS) | ||
4142 | #define BT_UART_MSG_FRAME3A2DP_POS (2) | ||
4143 | #define BT_UART_MSG_FRAME3A2DP_MSK \ | ||
4144 | (0x1 << BT_UART_MSG_FRAME3A2DP_POS) | ||
4145 | #define BT_UART_MSG_FRAME3ACL_POS (3) | ||
4146 | #define BT_UART_MSG_FRAME3ACL_MSK \ | ||
4147 | (0x1 << BT_UART_MSG_FRAME3ACL_POS) | ||
4148 | #define BT_UART_MSG_FRAME3MASTER_POS (4) | ||
4149 | #define BT_UART_MSG_FRAME3MASTER_MSK \ | ||
4150 | (0x1 << BT_UART_MSG_FRAME3MASTER_POS) | ||
4151 | #define BT_UART_MSG_FRAME3OBEX_POS (5) | ||
4152 | #define BT_UART_MSG_FRAME3OBEX_MSK \ | ||
4153 | (0x1 << BT_UART_MSG_FRAME3OBEX_POS) | ||
4154 | #define BT_UART_MSG_FRAME3RESERVED_POS (6) | ||
4155 | #define BT_UART_MSG_FRAME3RESERVED_MSK \ | ||
4156 | (0x3 << BT_UART_MSG_FRAME3RESERVED_POS) | ||
4157 | |||
4158 | #define BT_UART_MSG_FRAME4IDLEDURATION_POS (0) | ||
4159 | #define BT_UART_MSG_FRAME4IDLEDURATION_MSK \ | ||
4160 | (0x3F << BT_UART_MSG_FRAME4IDLEDURATION_POS) | ||
4161 | #define BT_UART_MSG_FRAME4RESERVED_POS (6) | ||
4162 | #define BT_UART_MSG_FRAME4RESERVED_MSK \ | ||
4163 | (0x3 << BT_UART_MSG_FRAME4RESERVED_POS) | ||
4164 | |||
4165 | #define BT_UART_MSG_FRAME5TXACTIVITY_POS (0) | ||
4166 | #define BT_UART_MSG_FRAME5TXACTIVITY_MSK \ | ||
4167 | (0x3 << BT_UART_MSG_FRAME5TXACTIVITY_POS) | ||
4168 | #define BT_UART_MSG_FRAME5RXACTIVITY_POS (2) | ||
4169 | #define BT_UART_MSG_FRAME5RXACTIVITY_MSK \ | ||
4170 | (0x3 << BT_UART_MSG_FRAME5RXACTIVITY_POS) | ||
4171 | #define BT_UART_MSG_FRAME5ESCORETRANSMIT_POS (4) | ||
4172 | #define BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK \ | ||
4173 | (0x3 << BT_UART_MSG_FRAME5ESCORETRANSMIT_POS) | ||
4174 | #define BT_UART_MSG_FRAME5RESERVED_POS (6) | ||
4175 | #define BT_UART_MSG_FRAME5RESERVED_MSK \ | ||
4176 | (0x3 << BT_UART_MSG_FRAME5RESERVED_POS) | ||
4177 | |||
4178 | #define BT_UART_MSG_FRAME6SNIFFINTERVAL_POS (0) | ||
4179 | #define BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK \ | ||
4180 | (0x1F << BT_UART_MSG_FRAME6SNIFFINTERVAL_POS) | ||
4181 | #define BT_UART_MSG_FRAME6DISCOVERABLE_POS (5) | ||
4182 | #define BT_UART_MSG_FRAME6DISCOVERABLE_MSK \ | ||
4183 | (0x1 << BT_UART_MSG_FRAME6DISCOVERABLE_POS) | ||
4184 | #define BT_UART_MSG_FRAME6RESERVED_POS (6) | ||
4185 | #define BT_UART_MSG_FRAME6RESERVED_MSK \ | ||
4186 | (0x3 << BT_UART_MSG_FRAME6RESERVED_POS) | ||
4187 | |||
4188 | #define BT_UART_MSG_FRAME7SNIFFACTIVITY_POS (0) | ||
4189 | #define BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK \ | ||
4190 | (0x7 << BT_UART_MSG_FRAME7SNIFFACTIVITY_POS) | ||
4191 | #define BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_POS (3) | ||
4192 | #define BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_MSK \ | ||
4193 | (0x3 << BT_UART_MSG_FRAME7INQUIRYPAGESRMODE_POS) | ||
4194 | #define BT_UART_MSG_FRAME7CONNECTABLE_POS (5) | ||
4195 | #define BT_UART_MSG_FRAME7CONNECTABLE_MSK \ | ||
4196 | (0x1 << BT_UART_MSG_FRAME7CONNECTABLE_POS) | ||
4197 | #define BT_UART_MSG_FRAME7RESERVED_POS (6) | ||
4198 | #define BT_UART_MSG_FRAME7RESERVED_MSK \ | ||
4199 | (0x3 << BT_UART_MSG_FRAME7RESERVED_POS) | ||
4200 | |||
4201 | |||
4202 | struct iwl_bt_uart_msg { | ||
4203 | u8 header; | ||
4204 | u8 frame1; | ||
4205 | u8 frame2; | ||
4206 | u8 frame3; | ||
4207 | u8 frame4; | ||
4208 | u8 frame5; | ||
4209 | u8 frame6; | ||
4210 | u8 frame7; | ||
4211 | } __attribute__((packed)); | ||
4212 | |||
4213 | struct iwl_bt_coex_profile_notif { | ||
4214 | struct iwl_bt_uart_msg last_bt_uart_msg; | ||
4215 | u8 bt_status; /* 0 - off, 1 - on */ | ||
4216 | u8 bt_traffic_load; /* 0 .. 3? */ | ||
4217 | u8 bt_ci_compliance; /* 0 - not complied, 1 - complied */ | ||
4218 | u8 reserved; | ||
4219 | } __attribute__((packed)); | ||
4220 | |||
4221 | #define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS 0 | ||
4222 | #define IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_MSK 0x1 | ||
4223 | #define IWL_BT_COEX_PRIO_TBL_PRIO_POS 1 | ||
4224 | #define IWL_BT_COEX_PRIO_TBL_PRIO_MASK 0x0e | ||
4225 | #define IWL_BT_COEX_PRIO_TBL_RESERVED_POS 4 | ||
4226 | #define IWL_BT_COEX_PRIO_TBL_RESERVED_MASK 0xf0 | ||
4227 | #define IWL_BT_COEX_PRIO_TBL_PRIO_SHIFT 1 | ||
4228 | |||
4229 | /* | ||
4230 | * BT Coexistence Priority table | ||
4231 | * REPLY_BT_COEX_PRIO_TABLE = 0xcc | ||
4232 | */ | ||
4233 | enum bt_coex_prio_table_events { | ||
4234 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, | ||
4235 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1, | ||
4236 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2, | ||
4237 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, /* DC calib */ | ||
4238 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4, | ||
4239 | BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5, | ||
4240 | BT_COEX_PRIO_TBL_EVT_DTIM = 6, | ||
4241 | BT_COEX_PRIO_TBL_EVT_SCAN52 = 7, | ||
4242 | BT_COEX_PRIO_TBL_EVT_SCAN24 = 8, | ||
4243 | BT_COEX_PRIO_TBL_EVT_RESERVED0 = 9, | ||
4244 | BT_COEX_PRIO_TBL_EVT_RESERVED1 = 10, | ||
4245 | BT_COEX_PRIO_TBL_EVT_RESERVED2 = 11, | ||
4246 | BT_COEX_PRIO_TBL_EVT_RESERVED3 = 12, | ||
4247 | BT_COEX_PRIO_TBL_EVT_RESERVED4 = 13, | ||
4248 | BT_COEX_PRIO_TBL_EVT_RESERVED5 = 14, | ||
4249 | BT_COEX_PRIO_TBL_EVT_RESERVED6 = 15, | ||
4250 | /* BT_COEX_PRIO_TBL_EVT_MAX should always be last */ | ||
4251 | BT_COEX_PRIO_TBL_EVT_MAX, | ||
4252 | }; | ||
4253 | |||
4254 | enum bt_coex_prio_table_priorities { | ||
4255 | BT_COEX_PRIO_TBL_DISABLED = 0, | ||
4256 | BT_COEX_PRIO_TBL_PRIO_LOW = 1, | ||
4257 | BT_COEX_PRIO_TBL_PRIO_HIGH = 2, | ||
4258 | BT_COEX_PRIO_TBL_PRIO_BYPASS = 3, | ||
4259 | BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4, | ||
4260 | BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5, | ||
4261 | BT_COEX_PRIO_TBL_PRIO_RSRVD1 = 6, | ||
4262 | BT_COEX_PRIO_TBL_PRIO_RSRVD2 = 7, | ||
4263 | BT_COEX_PRIO_TBL_MAX, | ||
4264 | }; | ||
4265 | |||
4266 | struct iwl_bt_coex_prio_table_cmd { | ||
4267 | u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; | ||
4268 | } __attribute__((packed)); | ||
4269 | |||
4270 | #define IWL_BT_COEX_ENV_CLOSE 0 | ||
4271 | #define IWL_BT_COEX_ENV_OPEN 1 | ||
4272 | /* | ||
4273 | * BT Protection Envelope | ||
4274 | * REPLY_BT_COEX_PROT_ENV = 0xcd | ||
4275 | */ | ||
4276 | struct iwl_bt_coex_prot_env_cmd { | ||
4277 | u8 action; /* 0 = closed, 1 = open */ | ||
4278 | u8 type; /* 0 .. 15 */ | ||
4279 | u8 reserved[2]; | ||
4280 | } __attribute__((packed)); | ||
4281 | |||
4282 | /****************************************************************************** | ||
3968 | * (13) | 4283 | * (13) |
3969 | * Union of all expected notifications/responses: | 4284 | * Union of all expected notifications/responses: |
3970 | * | 4285 | * |
@@ -4003,6 +4318,7 @@ struct iwl_rx_packet { | |||
4003 | struct iwl_missed_beacon_notif missed_beacon; | 4318 | struct iwl_missed_beacon_notif missed_beacon; |
4004 | struct iwl_coex_medium_notification coex_medium_notif; | 4319 | struct iwl_coex_medium_notification coex_medium_notif; |
4005 | struct iwl_coex_event_resp coex_event; | 4320 | struct iwl_coex_event_resp coex_event; |
4321 | struct iwl_bt_coex_profile_notif bt_coex_profile_notif; | ||
4006 | __le32 status; | 4322 | __le32 status; |
4007 | u8 raw[0]; | 4323 | u8 raw[0]; |
4008 | } u; | 4324 | } u; |
@@ -4010,4 +4326,94 @@ struct iwl_rx_packet { | |||
4010 | 4326 | ||
4011 | int iwl_agn_check_rxon_cmd(struct iwl_priv *priv); | 4327 | int iwl_agn_check_rxon_cmd(struct iwl_priv *priv); |
4012 | 4328 | ||
4329 | /* | ||
4330 | * REPLY_WIPAN_PARAMS = 0xb2 (Commands and Notification) | ||
4331 | */ | ||
4332 | |||
4333 | /** | ||
4334 | * struct iwl_wipan_slot | ||
4335 | * @width: Time in TU | ||
4336 | * @type: | ||
4337 | * 0 - BSS | ||
4338 | * 1 - PAN | ||
4339 | */ | ||
4340 | struct iwl_wipan_slot { | ||
4341 | __le16 width; | ||
4342 | u8 type; | ||
4343 | u8 reserved; | ||
4344 | } __packed; | ||
4345 | |||
4346 | #define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_CTS BIT(1) /* reserved */ | ||
4347 | #define IWL_WIPAN_PARAMS_FLG_LEAVE_CHANNEL_QUIET BIT(2) /* reserved */ | ||
4348 | #define IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE BIT(3) /* reserved */ | ||
4349 | #define IWL_WIPAN_PARAMS_FLG_FILTER_BEACON_NOTIF BIT(4) | ||
4350 | #define IWL_WIPAN_PARAMS_FLG_FULL_SLOTTED_MODE BIT(5) | ||
4351 | |||
4352 | /** | ||
4353 | * struct iwl_wipan_params_cmd | ||
4354 | * @flags: | ||
4355 | * bit0: reserved | ||
4356 | * bit1: CP leave channel with CTS | ||
4357 | * bit2: CP leave channel qith Quiet | ||
4358 | * bit3: slotted mode | ||
4359 | * 1 - work in slotted mode | ||
4360 | * 0 - work in non slotted mode | ||
4361 | * bit4: filter beacon notification | ||
4362 | * bit5: full tx slotted mode. if this flag is set, | ||
4363 | * uCode will perform leaving channel methods in context switch | ||
4364 | * also when working in same channel mode | ||
4365 | * @num_slots: 1 - 10 | ||
4366 | */ | ||
4367 | struct iwl_wipan_params_cmd { | ||
4368 | __le16 flags; | ||
4369 | u8 reserved; | ||
4370 | u8 num_slots; | ||
4371 | struct iwl_wipan_slot slots[10]; | ||
4372 | } __packed; | ||
4373 | |||
4374 | /* | ||
4375 | * REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9 | ||
4376 | * | ||
4377 | * TODO: Figure out what this is used for, | ||
4378 | * it can only switch between 2.4 GHz | ||
4379 | * channels!! | ||
4380 | */ | ||
4381 | |||
4382 | struct iwl_wipan_p2p_channel_switch_cmd { | ||
4383 | __le16 channel; | ||
4384 | __le16 reserved; | ||
4385 | }; | ||
4386 | |||
4387 | /* | ||
4388 | * REPLY_WIPAN_NOA_NOTIFICATION = 0xbc | ||
4389 | * | ||
4390 | * This is used by the device to notify us of the | ||
4391 | * NoA schedule it determined so we can forward it | ||
4392 | * to userspace for inclusion in probe responses. | ||
4393 | * | ||
4394 | * In beacons, the NoA schedule is simply appended | ||
4395 | * to the frame we give the device. | ||
4396 | */ | ||
4397 | |||
4398 | struct iwl_wipan_noa_descriptor { | ||
4399 | u8 count; | ||
4400 | __le32 duration; | ||
4401 | __le32 interval; | ||
4402 | __le32 starttime; | ||
4403 | } __packed; | ||
4404 | |||
4405 | struct iwl_wipan_noa_attribute { | ||
4406 | u8 id; | ||
4407 | __le16 length; | ||
4408 | u8 index; | ||
4409 | u8 ct_window; | ||
4410 | struct iwl_wipan_noa_descriptor descr0, descr1; | ||
4411 | u8 reserved; | ||
4412 | } __packed; | ||
4413 | |||
4414 | struct iwl_wipan_noa_notification { | ||
4415 | u32 noa_active; | ||
4416 | struct iwl_wipan_noa_attribute noa_attribute; | ||
4417 | } __packed; | ||
4418 | |||
4013 | #endif /* __iwl_commands_h__ */ | 4419 | #endif /* __iwl_commands_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 3d9443b9bec1..87a2e40972ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -64,7 +64,8 @@ MODULE_LICENSE("GPL"); | |||
64 | * | 64 | * |
65 | * default: bt_coex_active = true (BT_COEX_ENABLE) | 65 | * default: bt_coex_active = true (BT_COEX_ENABLE) |
66 | */ | 66 | */ |
67 | static bool bt_coex_active = true; | 67 | bool bt_coex_active = true; |
68 | EXPORT_SYMBOL_GPL(bt_coex_active); | ||
68 | module_param(bt_coex_active, bool, S_IRUGO); | 69 | module_param(bt_coex_active, bool, S_IRUGO); |
69 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); | 70 | MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); |
70 | 71 | ||
@@ -146,6 +147,10 @@ u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid) | |||
146 | int i; | 147 | int i; |
147 | u8 ind = ant; | 148 | u8 ind = ant; |
148 | 149 | ||
150 | if (priv->band == IEEE80211_BAND_2GHZ && | ||
151 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) | ||
152 | return 0; | ||
153 | |||
149 | for (i = 0; i < RATE_ANT_NUM - 1; i++) { | 154 | for (i = 0; i < RATE_ANT_NUM - 1; i++) { |
150 | ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; | 155 | ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; |
151 | if (valid & BIT(ind)) | 156 | if (valid & BIT(ind)) |
@@ -186,27 +191,27 @@ EXPORT_SYMBOL(iwl_alloc_all); | |||
186 | /* | 191 | /* |
187 | * QoS support | 192 | * QoS support |
188 | */ | 193 | */ |
189 | static void iwl_update_qos(struct iwl_priv *priv) | 194 | static void iwl_update_qos(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
190 | { | 195 | { |
191 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 196 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
192 | return; | 197 | return; |
193 | 198 | ||
194 | priv->qos_data.def_qos_parm.qos_flags = 0; | 199 | ctx->qos_data.def_qos_parm.qos_flags = 0; |
195 | 200 | ||
196 | if (priv->qos_data.qos_active) | 201 | if (ctx->qos_data.qos_active) |
197 | priv->qos_data.def_qos_parm.qos_flags |= | 202 | ctx->qos_data.def_qos_parm.qos_flags |= |
198 | QOS_PARAM_FLG_UPDATE_EDCA_MSK; | 203 | QOS_PARAM_FLG_UPDATE_EDCA_MSK; |
199 | 204 | ||
200 | if (priv->current_ht_config.is_ht) | 205 | if (ctx->ht.enabled) |
201 | priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; | 206 | ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; |
202 | 207 | ||
203 | IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", | 208 | IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", |
204 | priv->qos_data.qos_active, | 209 | ctx->qos_data.qos_active, |
205 | priv->qos_data.def_qos_parm.qos_flags); | 210 | ctx->qos_data.def_qos_parm.qos_flags); |
206 | 211 | ||
207 | iwl_send_cmd_pdu_async(priv, REPLY_QOS_PARAM, | 212 | iwl_send_cmd_pdu_async(priv, ctx->qos_cmd, |
208 | sizeof(struct iwl_qosparam_cmd), | 213 | sizeof(struct iwl_qosparam_cmd), |
209 | &priv->qos_data.def_qos_parm, NULL); | 214 | &ctx->qos_data.def_qos_parm, NULL); |
210 | } | 215 | } |
211 | 216 | ||
212 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ | 217 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ |
@@ -436,15 +441,15 @@ static bool is_single_rx_stream(struct iwl_priv *priv) | |||
436 | priv->current_ht_config.single_chain_sufficient; | 441 | priv->current_ht_config.single_chain_sufficient; |
437 | } | 442 | } |
438 | 443 | ||
439 | static u8 iwl_is_channel_extension(struct iwl_priv *priv, | 444 | static bool iwl_is_channel_extension(struct iwl_priv *priv, |
440 | enum ieee80211_band band, | 445 | enum ieee80211_band band, |
441 | u16 channel, u8 extension_chan_offset) | 446 | u16 channel, u8 extension_chan_offset) |
442 | { | 447 | { |
443 | const struct iwl_channel_info *ch_info; | 448 | const struct iwl_channel_info *ch_info; |
444 | 449 | ||
445 | ch_info = iwl_get_channel_info(priv, band, channel); | 450 | ch_info = iwl_get_channel_info(priv, band, channel); |
446 | if (!is_channel_valid(ch_info)) | 451 | if (!is_channel_valid(ch_info)) |
447 | return 0; | 452 | return false; |
448 | 453 | ||
449 | if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) | 454 | if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) |
450 | return !(ch_info->ht40_extension_channel & | 455 | return !(ch_info->ht40_extension_channel & |
@@ -453,31 +458,31 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv, | |||
453 | return !(ch_info->ht40_extension_channel & | 458 | return !(ch_info->ht40_extension_channel & |
454 | IEEE80211_CHAN_NO_HT40MINUS); | 459 | IEEE80211_CHAN_NO_HT40MINUS); |
455 | 460 | ||
456 | return 0; | 461 | return false; |
457 | } | 462 | } |
458 | 463 | ||
459 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, | 464 | bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
460 | struct ieee80211_sta_ht_cap *sta_ht_inf) | 465 | struct iwl_rxon_context *ctx, |
466 | struct ieee80211_sta_ht_cap *ht_cap) | ||
461 | { | 467 | { |
462 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | 468 | if (!ctx->ht.enabled || !ctx->ht.is_40mhz) |
463 | 469 | return false; | |
464 | if (!ht_conf->is_ht || !ht_conf->is_40mhz) | ||
465 | return 0; | ||
466 | 470 | ||
467 | /* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40 | 471 | /* |
472 | * We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40 | ||
468 | * the bit will not set if it is pure 40MHz case | 473 | * the bit will not set if it is pure 40MHz case |
469 | */ | 474 | */ |
470 | if (sta_ht_inf) { | 475 | if (ht_cap && !ht_cap->ht_supported) |
471 | if (!sta_ht_inf->ht_supported) | 476 | return false; |
472 | return 0; | 477 | |
473 | } | ||
474 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 478 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
475 | if (priv->disable_ht40) | 479 | if (priv->disable_ht40) |
476 | return 0; | 480 | return false; |
477 | #endif | 481 | #endif |
482 | |||
478 | return iwl_is_channel_extension(priv, priv->band, | 483 | return iwl_is_channel_extension(priv, priv->band, |
479 | le16_to_cpu(priv->staging_rxon.channel), | 484 | le16_to_cpu(ctx->staging.channel), |
480 | ht_conf->extension_chan_offset); | 485 | ctx->ht.extension_chan_offset); |
481 | } | 486 | } |
482 | EXPORT_SYMBOL(iwl_is_ht40_tx_allowed); | 487 | EXPORT_SYMBOL(iwl_is_ht40_tx_allowed); |
483 | 488 | ||
@@ -495,55 +500,64 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) | |||
495 | return new_val; | 500 | return new_val; |
496 | } | 501 | } |
497 | 502 | ||
498 | int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) | 503 | int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
499 | { | 504 | { |
500 | u64 tsf; | 505 | u64 tsf; |
501 | s32 interval_tm, rem; | 506 | s32 interval_tm, rem; |
502 | struct ieee80211_conf *conf = NULL; | 507 | struct ieee80211_conf *conf = NULL; |
503 | u16 beacon_int; | 508 | u16 beacon_int; |
509 | struct ieee80211_vif *vif = ctx->vif; | ||
504 | 510 | ||
505 | conf = ieee80211_get_hw_conf(priv->hw); | 511 | conf = ieee80211_get_hw_conf(priv->hw); |
506 | 512 | ||
507 | lockdep_assert_held(&priv->mutex); | 513 | lockdep_assert_held(&priv->mutex); |
508 | 514 | ||
509 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 515 | memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
510 | 516 | ||
511 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); | 517 | ctx->timing.timestamp = cpu_to_le64(priv->timestamp); |
512 | priv->rxon_timing.listen_interval = cpu_to_le16(conf->listen_interval); | 518 | ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); |
513 | 519 | ||
514 | beacon_int = vif->bss_conf.beacon_int; | 520 | beacon_int = vif ? vif->bss_conf.beacon_int : 0; |
515 | 521 | ||
516 | if (vif->type == NL80211_IFTYPE_ADHOC) { | 522 | /* |
517 | /* TODO: we need to get atim_window from upper stack | 523 | * TODO: For IBSS we need to get atim_window from mac80211, |
518 | * for now we set to 0 */ | 524 | * for now just always use 0 |
519 | priv->rxon_timing.atim_window = 0; | 525 | */ |
520 | } else { | 526 | ctx->timing.atim_window = 0; |
521 | priv->rxon_timing.atim_window = 0; | ||
522 | } | ||
523 | 527 | ||
524 | beacon_int = iwl_adjust_beacon_interval(beacon_int, | 528 | if (ctx->ctxid == IWL_RXON_CTX_PAN && |
529 | (!ctx->vif || ctx->vif->type != NL80211_IFTYPE_STATION)) { | ||
530 | ctx->timing.beacon_interval = | ||
531 | priv->contexts[IWL_RXON_CTX_BSS].timing.beacon_interval; | ||
532 | beacon_int = le16_to_cpu(ctx->timing.beacon_interval); | ||
533 | } else { | ||
534 | beacon_int = iwl_adjust_beacon_interval(beacon_int, | ||
525 | priv->hw_params.max_beacon_itrvl * TIME_UNIT); | 535 | priv->hw_params.max_beacon_itrvl * TIME_UNIT); |
526 | priv->rxon_timing.beacon_interval = cpu_to_le16(beacon_int); | 536 | ctx->timing.beacon_interval = cpu_to_le16(beacon_int); |
537 | } | ||
527 | 538 | ||
528 | tsf = priv->timestamp; /* tsf is modifed by do_div: copy it */ | 539 | tsf = priv->timestamp; /* tsf is modifed by do_div: copy it */ |
529 | interval_tm = beacon_int * TIME_UNIT; | 540 | interval_tm = beacon_int * TIME_UNIT; |
530 | rem = do_div(tsf, interval_tm); | 541 | rem = do_div(tsf, interval_tm); |
531 | priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem); | 542 | ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); |
543 | |||
544 | ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; | ||
532 | 545 | ||
533 | IWL_DEBUG_ASSOC(priv, | 546 | IWL_DEBUG_ASSOC(priv, |
534 | "beacon interval %d beacon timer %d beacon tim %d\n", | 547 | "beacon interval %d beacon timer %d beacon tim %d\n", |
535 | le16_to_cpu(priv->rxon_timing.beacon_interval), | 548 | le16_to_cpu(ctx->timing.beacon_interval), |
536 | le32_to_cpu(priv->rxon_timing.beacon_init_val), | 549 | le32_to_cpu(ctx->timing.beacon_init_val), |
537 | le16_to_cpu(priv->rxon_timing.atim_window)); | 550 | le16_to_cpu(ctx->timing.atim_window)); |
538 | 551 | ||
539 | return iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 552 | return iwl_send_cmd_pdu(priv, ctx->rxon_timing_cmd, |
540 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 553 | sizeof(ctx->timing), &ctx->timing); |
541 | } | 554 | } |
542 | EXPORT_SYMBOL(iwl_send_rxon_timing); | 555 | EXPORT_SYMBOL(iwl_send_rxon_timing); |
543 | 556 | ||
544 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) | 557 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
558 | int hw_decrypt) | ||
545 | { | 559 | { |
546 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 560 | struct iwl_rxon_cmd *rxon = &ctx->staging; |
547 | 561 | ||
548 | if (hw_decrypt) | 562 | if (hw_decrypt) |
549 | rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; | 563 | rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; |
@@ -560,11 +574,11 @@ EXPORT_SYMBOL(iwl_set_rxon_hwcrypto); | |||
560 | * be #ifdef'd out once the driver is stable and folks aren't actively | 574 | * be #ifdef'd out once the driver is stable and folks aren't actively |
561 | * making changes | 575 | * making changes |
562 | */ | 576 | */ |
563 | int iwl_check_rxon_cmd(struct iwl_priv *priv) | 577 | int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
564 | { | 578 | { |
565 | int error = 0; | 579 | int error = 0; |
566 | int counter = 1; | 580 | int counter = 1; |
567 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 581 | struct iwl_rxon_cmd *rxon = &ctx->staging; |
568 | 582 | ||
569 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { | 583 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { |
570 | error |= le32_to_cpu(rxon->flags & | 584 | error |= le32_to_cpu(rxon->flags & |
@@ -636,66 +650,83 @@ EXPORT_SYMBOL(iwl_check_rxon_cmd); | |||
636 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that | 650 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that |
637 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. | 651 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. |
638 | */ | 652 | */ |
639 | int iwl_full_rxon_required(struct iwl_priv *priv) | 653 | int iwl_full_rxon_required(struct iwl_priv *priv, |
654 | struct iwl_rxon_context *ctx) | ||
640 | { | 655 | { |
656 | const struct iwl_rxon_cmd *staging = &ctx->staging; | ||
657 | const struct iwl_rxon_cmd *active = &ctx->active; | ||
658 | |||
659 | #define CHK(cond) \ | ||
660 | if ((cond)) { \ | ||
661 | IWL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ | ||
662 | return 1; \ | ||
663 | } | ||
664 | |||
665 | #define CHK_NEQ(c1, c2) \ | ||
666 | if ((c1) != (c2)) { \ | ||
667 | IWL_DEBUG_INFO(priv, "need full RXON - " \ | ||
668 | #c1 " != " #c2 " - %d != %d\n", \ | ||
669 | (c1), (c2)); \ | ||
670 | return 1; \ | ||
671 | } | ||
641 | 672 | ||
642 | /* These items are only settable from the full RXON command */ | 673 | /* These items are only settable from the full RXON command */ |
643 | if (!(iwl_is_associated(priv)) || | 674 | CHK(!iwl_is_associated_ctx(ctx)); |
644 | compare_ether_addr(priv->staging_rxon.bssid_addr, | 675 | CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr)); |
645 | priv->active_rxon.bssid_addr) || | 676 | CHK(compare_ether_addr(staging->node_addr, active->node_addr)); |
646 | compare_ether_addr(priv->staging_rxon.node_addr, | 677 | CHK(compare_ether_addr(staging->wlap_bssid_addr, |
647 | priv->active_rxon.node_addr) || | 678 | active->wlap_bssid_addr)); |
648 | compare_ether_addr(priv->staging_rxon.wlap_bssid_addr, | 679 | CHK_NEQ(staging->dev_type, active->dev_type); |
649 | priv->active_rxon.wlap_bssid_addr) || | 680 | CHK_NEQ(staging->channel, active->channel); |
650 | (priv->staging_rxon.dev_type != priv->active_rxon.dev_type) || | 681 | CHK_NEQ(staging->air_propagation, active->air_propagation); |
651 | (priv->staging_rxon.channel != priv->active_rxon.channel) || | 682 | CHK_NEQ(staging->ofdm_ht_single_stream_basic_rates, |
652 | (priv->staging_rxon.air_propagation != | 683 | active->ofdm_ht_single_stream_basic_rates); |
653 | priv->active_rxon.air_propagation) || | 684 | CHK_NEQ(staging->ofdm_ht_dual_stream_basic_rates, |
654 | (priv->staging_rxon.ofdm_ht_single_stream_basic_rates != | 685 | active->ofdm_ht_dual_stream_basic_rates); |
655 | priv->active_rxon.ofdm_ht_single_stream_basic_rates) || | 686 | CHK_NEQ(staging->ofdm_ht_triple_stream_basic_rates, |
656 | (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != | 687 | active->ofdm_ht_triple_stream_basic_rates); |
657 | priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || | 688 | CHK_NEQ(staging->assoc_id, active->assoc_id); |
658 | (priv->staging_rxon.ofdm_ht_triple_stream_basic_rates != | ||
659 | priv->active_rxon.ofdm_ht_triple_stream_basic_rates) || | ||
660 | (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) | ||
661 | return 1; | ||
662 | 689 | ||
663 | /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can | 690 | /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can |
664 | * be updated with the RXON_ASSOC command -- however only some | 691 | * be updated with the RXON_ASSOC command -- however only some |
665 | * flag transitions are allowed using RXON_ASSOC */ | 692 | * flag transitions are allowed using RXON_ASSOC */ |
666 | 693 | ||
667 | /* Check if we are not switching bands */ | 694 | /* Check if we are not switching bands */ |
668 | if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) != | 695 | CHK_NEQ(staging->flags & RXON_FLG_BAND_24G_MSK, |
669 | (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK)) | 696 | active->flags & RXON_FLG_BAND_24G_MSK); |
670 | return 1; | ||
671 | 697 | ||
672 | /* Check if we are switching association toggle */ | 698 | /* Check if we are switching association toggle */ |
673 | if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) != | 699 | CHK_NEQ(staging->filter_flags & RXON_FILTER_ASSOC_MSK, |
674 | (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) | 700 | active->filter_flags & RXON_FILTER_ASSOC_MSK); |
675 | return 1; | 701 | |
702 | #undef CHK | ||
703 | #undef CHK_NEQ | ||
676 | 704 | ||
677 | return 0; | 705 | return 0; |
678 | } | 706 | } |
679 | EXPORT_SYMBOL(iwl_full_rxon_required); | 707 | EXPORT_SYMBOL(iwl_full_rxon_required); |
680 | 708 | ||
681 | u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv) | 709 | u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv, |
710 | struct iwl_rxon_context *ctx) | ||
682 | { | 711 | { |
683 | /* | 712 | /* |
684 | * Assign the lowest rate -- should really get this from | 713 | * Assign the lowest rate -- should really get this from |
685 | * the beacon skb from mac80211. | 714 | * the beacon skb from mac80211. |
686 | */ | 715 | */ |
687 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) | 716 | if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) |
688 | return IWL_RATE_1M_PLCP; | 717 | return IWL_RATE_1M_PLCP; |
689 | else | 718 | else |
690 | return IWL_RATE_6M_PLCP; | 719 | return IWL_RATE_6M_PLCP; |
691 | } | 720 | } |
692 | EXPORT_SYMBOL(iwl_rate_get_lowest_plcp); | 721 | EXPORT_SYMBOL(iwl_rate_get_lowest_plcp); |
693 | 722 | ||
694 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) | 723 | static void _iwl_set_rxon_ht(struct iwl_priv *priv, |
724 | struct iwl_ht_config *ht_conf, | ||
725 | struct iwl_rxon_context *ctx) | ||
695 | { | 726 | { |
696 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 727 | struct iwl_rxon_cmd *rxon = &ctx->staging; |
697 | 728 | ||
698 | if (!ht_conf->is_ht) { | 729 | if (!ctx->ht.enabled) { |
699 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | | 730 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | |
700 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | | 731 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | |
701 | RXON_FLG_HT40_PROT_MSK | | 732 | RXON_FLG_HT40_PROT_MSK | |
@@ -703,22 +734,22 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) | |||
703 | return; | 734 | return; |
704 | } | 735 | } |
705 | 736 | ||
706 | /* FIXME: if the definition of ht_protection changed, the "translation" | 737 | /* FIXME: if the definition of ht.protection changed, the "translation" |
707 | * will be needed for rxon->flags | 738 | * will be needed for rxon->flags |
708 | */ | 739 | */ |
709 | rxon->flags |= cpu_to_le32(ht_conf->ht_protection << RXON_FLG_HT_OPERATING_MODE_POS); | 740 | rxon->flags |= cpu_to_le32(ctx->ht.protection << RXON_FLG_HT_OPERATING_MODE_POS); |
710 | 741 | ||
711 | /* Set up channel bandwidth: | 742 | /* Set up channel bandwidth: |
712 | * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */ | 743 | * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */ |
713 | /* clear the HT channel mode before set the mode */ | 744 | /* clear the HT channel mode before set the mode */ |
714 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | | 745 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | |
715 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); | 746 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); |
716 | if (iwl_is_ht40_tx_allowed(priv, NULL)) { | 747 | if (iwl_is_ht40_tx_allowed(priv, ctx, NULL)) { |
717 | /* pure ht40 */ | 748 | /* pure ht40 */ |
718 | if (ht_conf->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { | 749 | if (ctx->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { |
719 | rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; | 750 | rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; |
720 | /* Note: control channel is opposite of extension channel */ | 751 | /* Note: control channel is opposite of extension channel */ |
721 | switch (ht_conf->extension_chan_offset) { | 752 | switch (ctx->ht.extension_chan_offset) { |
722 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | 753 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
723 | rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; | 754 | rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; |
724 | break; | 755 | break; |
@@ -728,7 +759,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) | |||
728 | } | 759 | } |
729 | } else { | 760 | } else { |
730 | /* Note: control channel is opposite of extension channel */ | 761 | /* Note: control channel is opposite of extension channel */ |
731 | switch (ht_conf->extension_chan_offset) { | 762 | switch (ctx->ht.extension_chan_offset) { |
732 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | 763 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
733 | rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); | 764 | rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); |
734 | rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; | 765 | rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; |
@@ -749,12 +780,20 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) | |||
749 | } | 780 | } |
750 | 781 | ||
751 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 782 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
752 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 783 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
753 | 784 | ||
754 | IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " | 785 | IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " |
755 | "extension channel offset 0x%x\n", | 786 | "extension channel offset 0x%x\n", |
756 | le32_to_cpu(rxon->flags), ht_conf->ht_protection, | 787 | le32_to_cpu(rxon->flags), ctx->ht.protection, |
757 | ht_conf->extension_chan_offset); | 788 | ctx->ht.extension_chan_offset); |
789 | } | ||
790 | |||
791 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) | ||
792 | { | ||
793 | struct iwl_rxon_context *ctx; | ||
794 | |||
795 | for_each_context(priv, ctx) | ||
796 | _iwl_set_rxon_ht(priv, ht_conf, ctx); | ||
758 | } | 797 | } |
759 | EXPORT_SYMBOL(iwl_set_rxon_ht); | 798 | EXPORT_SYMBOL(iwl_set_rxon_ht); |
760 | 799 | ||
@@ -775,6 +814,14 @@ EXPORT_SYMBOL(iwl_set_rxon_ht); | |||
775 | */ | 814 | */ |
776 | static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) | 815 | static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) |
777 | { | 816 | { |
817 | if (priv->cfg->advanced_bt_coexist && (priv->bt_full_concurrent || | ||
818 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { | ||
819 | /* | ||
820 | * only use chain 'A' in bt high traffic load or | ||
821 | * full concurrency mode | ||
822 | */ | ||
823 | return IWL_NUM_RX_CHAINS_SINGLE; | ||
824 | } | ||
778 | /* # of Rx chains to use when expecting MIMO. */ | 825 | /* # of Rx chains to use when expecting MIMO. */ |
779 | if (is_single_rx_stream(priv)) | 826 | if (is_single_rx_stream(priv)) |
780 | return IWL_NUM_RX_CHAINS_SINGLE; | 827 | return IWL_NUM_RX_CHAINS_SINGLE; |
@@ -819,7 +866,7 @@ static u8 iwl_count_chain_bitmap(u32 chain_bitmap) | |||
819 | * Selects how many and which Rx receivers/antennas/chains to use. | 866 | * Selects how many and which Rx receivers/antennas/chains to use. |
820 | * This should not be used for scan command ... it puts data in wrong place. | 867 | * This should not be used for scan command ... it puts data in wrong place. |
821 | */ | 868 | */ |
822 | void iwl_set_rxon_chain(struct iwl_priv *priv) | 869 | void iwl_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
823 | { | 870 | { |
824 | bool is_single = is_single_rx_stream(priv); | 871 | bool is_single = is_single_rx_stream(priv); |
825 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | 872 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); |
@@ -831,11 +878,20 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
831 | * Before first association, we assume all antennas are connected. | 878 | * Before first association, we assume all antennas are connected. |
832 | * Just after first association, iwl_chain_noise_calibration() | 879 | * Just after first association, iwl_chain_noise_calibration() |
833 | * checks which antennas actually *are* connected. */ | 880 | * checks which antennas actually *are* connected. */ |
834 | if (priv->chain_noise_data.active_chains) | 881 | if (priv->chain_noise_data.active_chains) |
835 | active_chains = priv->chain_noise_data.active_chains; | 882 | active_chains = priv->chain_noise_data.active_chains; |
836 | else | 883 | else |
837 | active_chains = priv->hw_params.valid_rx_ant; | 884 | active_chains = priv->hw_params.valid_rx_ant; |
838 | 885 | ||
886 | if (priv->cfg->advanced_bt_coexist && (priv->bt_full_concurrent || | ||
887 | priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { | ||
888 | /* | ||
889 | * only use chain 'A' in bt high traffic load or | ||
890 | * full concurrency mode | ||
891 | */ | ||
892 | active_chains = first_antenna(active_chains); | ||
893 | } | ||
894 | |||
839 | rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; | 895 | rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; |
840 | 896 | ||
841 | /* How many receivers should we use? */ | 897 | /* How many receivers should we use? */ |
@@ -856,15 +912,15 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
856 | rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; | 912 | rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; |
857 | rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; | 913 | rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; |
858 | 914 | ||
859 | priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain); | 915 | ctx->staging.rx_chain = cpu_to_le16(rx_chain); |
860 | 916 | ||
861 | if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) | 917 | if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) |
862 | priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; | 918 | ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; |
863 | else | 919 | else |
864 | priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; | 920 | ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; |
865 | 921 | ||
866 | IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", | 922 | IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", |
867 | priv->staging_rxon.rx_chain, | 923 | ctx->staging.rx_chain, |
868 | active_rx_cnt, idle_rx_cnt); | 924 | active_rx_cnt, idle_rx_cnt); |
869 | 925 | ||
870 | WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || | 926 | WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || |
@@ -872,39 +928,41 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
872 | } | 928 | } |
873 | EXPORT_SYMBOL(iwl_set_rxon_chain); | 929 | EXPORT_SYMBOL(iwl_set_rxon_chain); |
874 | 930 | ||
875 | /* Return valid channel */ | 931 | /* Return valid, unused, channel for a passive scan to reset the RF */ |
876 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, | 932 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, |
877 | enum ieee80211_band band) | 933 | enum ieee80211_band band) |
878 | { | 934 | { |
879 | const struct iwl_channel_info *ch_info; | 935 | const struct iwl_channel_info *ch_info; |
880 | int i; | 936 | int i; |
881 | u8 channel = 0; | 937 | u8 channel = 0; |
938 | u8 min, max; | ||
939 | struct iwl_rxon_context *ctx; | ||
882 | 940 | ||
883 | /* only scan single channel, good enough to reset the RF */ | ||
884 | /* pick the first valid not in-use channel */ | ||
885 | if (band == IEEE80211_BAND_5GHZ) { | 941 | if (band == IEEE80211_BAND_5GHZ) { |
886 | for (i = 14; i < priv->channel_count; i++) { | 942 | min = 14; |
887 | if (priv->channel_info[i].channel != | 943 | max = priv->channel_count; |
888 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
889 | channel = priv->channel_info[i].channel; | ||
890 | ch_info = iwl_get_channel_info(priv, | ||
891 | band, channel); | ||
892 | if (is_channel_valid(ch_info)) | ||
893 | break; | ||
894 | } | ||
895 | } | ||
896 | } else { | 944 | } else { |
897 | for (i = 0; i < 14; i++) { | 945 | min = 0; |
898 | if (priv->channel_info[i].channel != | 946 | max = 14; |
899 | le16_to_cpu(priv->staging_rxon.channel)) { | 947 | } |
900 | channel = | 948 | |
901 | priv->channel_info[i].channel; | 949 | for (i = min; i < max; i++) { |
902 | ch_info = iwl_get_channel_info(priv, | 950 | bool busy = false; |
903 | band, channel); | 951 | |
904 | if (is_channel_valid(ch_info)) | 952 | for_each_context(priv, ctx) { |
905 | break; | 953 | busy = priv->channel_info[i].channel == |
906 | } | 954 | le16_to_cpu(ctx->staging.channel); |
955 | if (busy) | ||
956 | break; | ||
907 | } | 957 | } |
958 | |||
959 | if (busy) | ||
960 | continue; | ||
961 | |||
962 | channel = priv->channel_info[i].channel; | ||
963 | ch_info = iwl_get_channel_info(priv, band, channel); | ||
964 | if (is_channel_valid(ch_info)) | ||
965 | break; | ||
908 | } | 966 | } |
909 | 967 | ||
910 | return channel; | 968 | return channel; |
@@ -915,25 +973,24 @@ EXPORT_SYMBOL(iwl_get_single_channel_number); | |||
915 | * iwl_set_rxon_channel - Set the band and channel values in staging RXON | 973 | * iwl_set_rxon_channel - Set the band and channel values in staging RXON |
916 | * @ch: requested channel as a pointer to struct ieee80211_channel | 974 | * @ch: requested channel as a pointer to struct ieee80211_channel |
917 | 975 | ||
918 | * In addition to setting the staging RXON, priv->band is also set. | ||
919 | * | ||
920 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields | 976 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields |
921 | * in the staging RXON flag structure based on the ch->band | 977 | * in the staging RXON flag structure based on the ch->band |
922 | */ | 978 | */ |
923 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch) | 979 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, |
980 | struct iwl_rxon_context *ctx) | ||
924 | { | 981 | { |
925 | enum ieee80211_band band = ch->band; | 982 | enum ieee80211_band band = ch->band; |
926 | u16 channel = ch->hw_value; | 983 | u16 channel = ch->hw_value; |
927 | 984 | ||
928 | if ((le16_to_cpu(priv->staging_rxon.channel) == channel) && | 985 | if ((le16_to_cpu(ctx->staging.channel) == channel) && |
929 | (priv->band == band)) | 986 | (priv->band == band)) |
930 | return 0; | 987 | return 0; |
931 | 988 | ||
932 | priv->staging_rxon.channel = cpu_to_le16(channel); | 989 | ctx->staging.channel = cpu_to_le16(channel); |
933 | if (band == IEEE80211_BAND_5GHZ) | 990 | if (band == IEEE80211_BAND_5GHZ) |
934 | priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK; | 991 | ctx->staging.flags &= ~RXON_FLG_BAND_24G_MSK; |
935 | else | 992 | else |
936 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 993 | ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; |
937 | 994 | ||
938 | priv->band = band; | 995 | priv->band = band; |
939 | 996 | ||
@@ -944,24 +1001,25 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch) | |||
944 | EXPORT_SYMBOL(iwl_set_rxon_channel); | 1001 | EXPORT_SYMBOL(iwl_set_rxon_channel); |
945 | 1002 | ||
946 | void iwl_set_flags_for_band(struct iwl_priv *priv, | 1003 | void iwl_set_flags_for_band(struct iwl_priv *priv, |
1004 | struct iwl_rxon_context *ctx, | ||
947 | enum ieee80211_band band, | 1005 | enum ieee80211_band band, |
948 | struct ieee80211_vif *vif) | 1006 | struct ieee80211_vif *vif) |
949 | { | 1007 | { |
950 | if (band == IEEE80211_BAND_5GHZ) { | 1008 | if (band == IEEE80211_BAND_5GHZ) { |
951 | priv->staging_rxon.flags &= | 1009 | ctx->staging.flags &= |
952 | ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | 1010 | ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK |
953 | | RXON_FLG_CCK_MSK); | 1011 | | RXON_FLG_CCK_MSK); |
954 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 1012 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
955 | } else { | 1013 | } else { |
956 | /* Copied from iwl_post_associate() */ | 1014 | /* Copied from iwl_post_associate() */ |
957 | if (vif && vif->bss_conf.use_short_slot) | 1015 | if (vif && vif->bss_conf.use_short_slot) |
958 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 1016 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
959 | else | 1017 | else |
960 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 1018 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
961 | 1019 | ||
962 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | 1020 | ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; |
963 | priv->staging_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK; | 1021 | ctx->staging.flags |= RXON_FLG_AUTO_DETECT_MSK; |
964 | priv->staging_rxon.flags &= ~RXON_FLG_CCK_MSK; | 1022 | ctx->staging.flags &= ~RXON_FLG_CCK_MSK; |
965 | } | 1023 | } |
966 | } | 1024 | } |
967 | EXPORT_SYMBOL(iwl_set_flags_for_band); | 1025 | EXPORT_SYMBOL(iwl_set_flags_for_band); |
@@ -970,35 +1028,34 @@ EXPORT_SYMBOL(iwl_set_flags_for_band); | |||
970 | * initialize rxon structure with default values from eeprom | 1028 | * initialize rxon structure with default values from eeprom |
971 | */ | 1029 | */ |
972 | void iwl_connection_init_rx_config(struct iwl_priv *priv, | 1030 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
973 | struct ieee80211_vif *vif) | 1031 | struct iwl_rxon_context *ctx) |
974 | { | 1032 | { |
975 | const struct iwl_channel_info *ch_info; | 1033 | const struct iwl_channel_info *ch_info; |
976 | enum nl80211_iftype type = NL80211_IFTYPE_STATION; | ||
977 | 1034 | ||
978 | if (vif) | 1035 | memset(&ctx->staging, 0, sizeof(ctx->staging)); |
979 | type = vif->type; | ||
980 | 1036 | ||
981 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 1037 | if (!ctx->vif) { |
982 | 1038 | ctx->staging.dev_type = ctx->unused_devtype; | |
983 | switch (type) { | 1039 | } else switch (ctx->vif->type) { |
984 | case NL80211_IFTYPE_AP: | 1040 | case NL80211_IFTYPE_AP: |
985 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; | 1041 | ctx->staging.dev_type = ctx->ap_devtype; |
986 | break; | 1042 | break; |
987 | 1043 | ||
988 | case NL80211_IFTYPE_STATION: | 1044 | case NL80211_IFTYPE_STATION: |
989 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS; | 1045 | ctx->staging.dev_type = ctx->station_devtype; |
990 | priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; | 1046 | ctx->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; |
991 | break; | 1047 | break; |
992 | 1048 | ||
993 | case NL80211_IFTYPE_ADHOC: | 1049 | case NL80211_IFTYPE_ADHOC: |
994 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS; | 1050 | ctx->staging.dev_type = ctx->ibss_devtype; |
995 | priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK; | 1051 | ctx->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; |
996 | priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK | | 1052 | ctx->staging.filter_flags = RXON_FILTER_BCON_AWARE_MSK | |
997 | RXON_FILTER_ACCEPT_GRP_MSK; | 1053 | RXON_FILTER_ACCEPT_GRP_MSK; |
998 | break; | 1054 | break; |
999 | 1055 | ||
1000 | default: | 1056 | default: |
1001 | IWL_ERR(priv, "Unsupported interface type %d\n", type); | 1057 | IWL_ERR(priv, "Unsupported interface type %d\n", |
1058 | ctx->vif->type); | ||
1002 | break; | 1059 | break; |
1003 | } | 1060 | } |
1004 | 1061 | ||
@@ -1006,37 +1063,36 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, | |||
1006 | /* TODO: Figure out when short_preamble would be set and cache from | 1063 | /* TODO: Figure out when short_preamble would be set and cache from |
1007 | * that */ | 1064 | * that */ |
1008 | if (!hw_to_local(priv->hw)->short_preamble) | 1065 | if (!hw_to_local(priv->hw)->short_preamble) |
1009 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 1066 | ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
1010 | else | 1067 | else |
1011 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 1068 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
1012 | #endif | 1069 | #endif |
1013 | 1070 | ||
1014 | ch_info = iwl_get_channel_info(priv, priv->band, | 1071 | ch_info = iwl_get_channel_info(priv, priv->band, |
1015 | le16_to_cpu(priv->active_rxon.channel)); | 1072 | le16_to_cpu(ctx->active.channel)); |
1016 | 1073 | ||
1017 | if (!ch_info) | 1074 | if (!ch_info) |
1018 | ch_info = &priv->channel_info[0]; | 1075 | ch_info = &priv->channel_info[0]; |
1019 | 1076 | ||
1020 | priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); | 1077 | ctx->staging.channel = cpu_to_le16(ch_info->channel); |
1021 | priv->band = ch_info->band; | 1078 | priv->band = ch_info->band; |
1022 | 1079 | ||
1023 | iwl_set_flags_for_band(priv, priv->band, vif); | 1080 | iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif); |
1024 | 1081 | ||
1025 | priv->staging_rxon.ofdm_basic_rates = | 1082 | ctx->staging.ofdm_basic_rates = |
1026 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 1083 | (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
1027 | priv->staging_rxon.cck_basic_rates = | 1084 | ctx->staging.cck_basic_rates = |
1028 | (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; | 1085 | (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; |
1029 | 1086 | ||
1030 | /* clear both MIX and PURE40 mode flag */ | 1087 | /* clear both MIX and PURE40 mode flag */ |
1031 | priv->staging_rxon.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | | 1088 | ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | |
1032 | RXON_FLG_CHANNEL_MODE_PURE_40); | 1089 | RXON_FLG_CHANNEL_MODE_PURE_40); |
1090 | if (ctx->vif) | ||
1091 | memcpy(ctx->staging.node_addr, ctx->vif->addr, ETH_ALEN); | ||
1033 | 1092 | ||
1034 | if (vif) | 1093 | ctx->staging.ofdm_ht_single_stream_basic_rates = 0xff; |
1035 | memcpy(priv->staging_rxon.node_addr, vif->addr, ETH_ALEN); | 1094 | ctx->staging.ofdm_ht_dual_stream_basic_rates = 0xff; |
1036 | 1095 | ctx->staging.ofdm_ht_triple_stream_basic_rates = 0xff; | |
1037 | priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff; | ||
1038 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff; | ||
1039 | priv->staging_rxon.ofdm_ht_triple_stream_basic_rates = 0xff; | ||
1040 | } | 1096 | } |
1041 | EXPORT_SYMBOL(iwl_connection_init_rx_config); | 1097 | EXPORT_SYMBOL(iwl_connection_init_rx_config); |
1042 | 1098 | ||
@@ -1044,6 +1100,7 @@ void iwl_set_rate(struct iwl_priv *priv) | |||
1044 | { | 1100 | { |
1045 | const struct ieee80211_supported_band *hw = NULL; | 1101 | const struct ieee80211_supported_band *hw = NULL; |
1046 | struct ieee80211_rate *rate; | 1102 | struct ieee80211_rate *rate; |
1103 | struct iwl_rxon_context *ctx; | ||
1047 | int i; | 1104 | int i; |
1048 | 1105 | ||
1049 | hw = iwl_get_hw_mode(priv, priv->band); | 1106 | hw = iwl_get_hw_mode(priv, priv->band); |
@@ -1062,21 +1119,29 @@ void iwl_set_rate(struct iwl_priv *priv) | |||
1062 | 1119 | ||
1063 | IWL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); | 1120 | IWL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); |
1064 | 1121 | ||
1065 | priv->staging_rxon.cck_basic_rates = | 1122 | for_each_context(priv, ctx) { |
1066 | (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; | 1123 | ctx->staging.cck_basic_rates = |
1124 | (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF; | ||
1067 | 1125 | ||
1068 | priv->staging_rxon.ofdm_basic_rates = | 1126 | ctx->staging.ofdm_basic_rates = |
1069 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 1127 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
1128 | } | ||
1070 | } | 1129 | } |
1071 | EXPORT_SYMBOL(iwl_set_rate); | 1130 | EXPORT_SYMBOL(iwl_set_rate); |
1072 | 1131 | ||
1073 | void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) | 1132 | void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) |
1074 | { | 1133 | { |
1134 | /* | ||
1135 | * MULTI-FIXME | ||
1136 | * See iwl_mac_channel_switch. | ||
1137 | */ | ||
1138 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
1139 | |||
1075 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1140 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
1076 | return; | 1141 | return; |
1077 | 1142 | ||
1078 | if (priv->switch_rxon.switch_in_progress) { | 1143 | if (priv->switch_rxon.switch_in_progress) { |
1079 | ieee80211_chswitch_done(priv->vif, is_success); | 1144 | ieee80211_chswitch_done(ctx->vif, is_success); |
1080 | mutex_lock(&priv->mutex); | 1145 | mutex_lock(&priv->mutex); |
1081 | priv->switch_rxon.switch_in_progress = false; | 1146 | priv->switch_rxon.switch_in_progress = false; |
1082 | mutex_unlock(&priv->mutex); | 1147 | mutex_unlock(&priv->mutex); |
@@ -1087,14 +1152,19 @@ EXPORT_SYMBOL(iwl_chswitch_done); | |||
1087 | void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | 1152 | void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) |
1088 | { | 1153 | { |
1089 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 1154 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
1090 | struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; | ||
1091 | struct iwl_csa_notification *csa = &(pkt->u.csa_notif); | 1155 | struct iwl_csa_notification *csa = &(pkt->u.csa_notif); |
1156 | /* | ||
1157 | * MULTI-FIXME | ||
1158 | * See iwl_mac_channel_switch. | ||
1159 | */ | ||
1160 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
1161 | struct iwl_rxon_cmd *rxon = (void *)&ctx->active; | ||
1092 | 1162 | ||
1093 | if (priv->switch_rxon.switch_in_progress) { | 1163 | if (priv->switch_rxon.switch_in_progress) { |
1094 | if (!le32_to_cpu(csa->status) && | 1164 | if (!le32_to_cpu(csa->status) && |
1095 | (csa->channel == priv->switch_rxon.channel)) { | 1165 | (csa->channel == priv->switch_rxon.channel)) { |
1096 | rxon->channel = csa->channel; | 1166 | rxon->channel = csa->channel; |
1097 | priv->staging_rxon.channel = csa->channel; | 1167 | ctx->staging.channel = csa->channel; |
1098 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", | 1168 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", |
1099 | le16_to_cpu(csa->channel)); | 1169 | le16_to_cpu(csa->channel)); |
1100 | iwl_chswitch_done(priv, true); | 1170 | iwl_chswitch_done(priv, true); |
@@ -1108,9 +1178,10 @@ void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
1108 | EXPORT_SYMBOL(iwl_rx_csa); | 1178 | EXPORT_SYMBOL(iwl_rx_csa); |
1109 | 1179 | ||
1110 | #ifdef CONFIG_IWLWIFI_DEBUG | 1180 | #ifdef CONFIG_IWLWIFI_DEBUG |
1111 | void iwl_print_rx_config_cmd(struct iwl_priv *priv) | 1181 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
1182 | struct iwl_rxon_context *ctx) | ||
1112 | { | 1183 | { |
1113 | struct iwl_rxon_cmd *rxon = &priv->staging_rxon; | 1184 | struct iwl_rxon_cmd *rxon = &ctx->staging; |
1114 | 1185 | ||
1115 | IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); | 1186 | IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); |
1116 | iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); | 1187 | iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); |
@@ -1150,7 +1221,8 @@ void iwl_irq_handle_error(struct iwl_priv *priv) | |||
1150 | priv->cfg->ops->lib->dump_nic_event_log(priv, false, NULL, false); | 1221 | priv->cfg->ops->lib->dump_nic_event_log(priv, false, NULL, false); |
1151 | #ifdef CONFIG_IWLWIFI_DEBUG | 1222 | #ifdef CONFIG_IWLWIFI_DEBUG |
1152 | if (iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) | 1223 | if (iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) |
1153 | iwl_print_rx_config_cmd(priv); | 1224 | iwl_print_rx_config_cmd(priv, |
1225 | &priv->contexts[IWL_RXON_CTX_BSS]); | ||
1154 | #endif | 1226 | #endif |
1155 | 1227 | ||
1156 | wake_up_interruptible(&priv->wait_command_queue); | 1228 | wake_up_interruptible(&priv->wait_command_queue); |
@@ -1518,6 +1590,7 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1518 | const struct ieee80211_tx_queue_params *params) | 1590 | const struct ieee80211_tx_queue_params *params) |
1519 | { | 1591 | { |
1520 | struct iwl_priv *priv = hw->priv; | 1592 | struct iwl_priv *priv = hw->priv; |
1593 | struct iwl_rxon_context *ctx; | ||
1521 | unsigned long flags; | 1594 | unsigned long flags; |
1522 | int q; | 1595 | int q; |
1523 | 1596 | ||
@@ -1537,13 +1610,21 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1537 | 1610 | ||
1538 | spin_lock_irqsave(&priv->lock, flags); | 1611 | spin_lock_irqsave(&priv->lock, flags); |
1539 | 1612 | ||
1540 | priv->qos_data.def_qos_parm.ac[q].cw_min = cpu_to_le16(params->cw_min); | 1613 | /* |
1541 | priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max); | 1614 | * MULTI-FIXME |
1542 | priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; | 1615 | * This may need to be done per interface in nl80211/cfg80211/mac80211. |
1543 | priv->qos_data.def_qos_parm.ac[q].edca_txop = | 1616 | */ |
1544 | cpu_to_le16((params->txop * 32)); | 1617 | for_each_context(priv, ctx) { |
1618 | ctx->qos_data.def_qos_parm.ac[q].cw_min = | ||
1619 | cpu_to_le16(params->cw_min); | ||
1620 | ctx->qos_data.def_qos_parm.ac[q].cw_max = | ||
1621 | cpu_to_le16(params->cw_max); | ||
1622 | ctx->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; | ||
1623 | ctx->qos_data.def_qos_parm.ac[q].edca_txop = | ||
1624 | cpu_to_le16((params->txop * 32)); | ||
1545 | 1625 | ||
1546 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; | 1626 | ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; |
1627 | } | ||
1547 | 1628 | ||
1548 | spin_unlock_irqrestore(&priv->lock, flags); | 1629 | spin_unlock_irqrestore(&priv->lock, flags); |
1549 | 1630 | ||
@@ -1566,15 +1647,16 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
1566 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | 1647 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; |
1567 | struct ieee80211_sta *sta; | 1648 | struct ieee80211_sta *sta; |
1568 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | 1649 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; |
1650 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | ||
1569 | 1651 | ||
1570 | IWL_DEBUG_MAC80211(priv, "enter:\n"); | 1652 | IWL_DEBUG_MAC80211(priv, "enter:\n"); |
1571 | 1653 | ||
1572 | if (!ht_conf->is_ht) | 1654 | if (!ctx->ht.enabled) |
1573 | return; | 1655 | return; |
1574 | 1656 | ||
1575 | ht_conf->ht_protection = | 1657 | ctx->ht.protection = |
1576 | bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; | 1658 | bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; |
1577 | ht_conf->non_GF_STA_present = | 1659 | ctx->ht.non_gf_sta_present = |
1578 | !!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); | 1660 | !!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); |
1579 | 1661 | ||
1580 | ht_conf->single_chain_sufficient = false; | 1662 | ht_conf->single_chain_sufficient = false; |
@@ -1618,18 +1700,20 @@ static void iwl_ht_conf(struct iwl_priv *priv, | |||
1618 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1700 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
1619 | } | 1701 | } |
1620 | 1702 | ||
1621 | static inline void iwl_set_no_assoc(struct iwl_priv *priv) | 1703 | static inline void iwl_set_no_assoc(struct iwl_priv *priv, |
1704 | struct ieee80211_vif *vif) | ||
1622 | { | 1705 | { |
1706 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | ||
1707 | |||
1623 | iwl_led_disassociate(priv); | 1708 | iwl_led_disassociate(priv); |
1624 | /* | 1709 | /* |
1625 | * inform the ucode that there is no longer an | 1710 | * inform the ucode that there is no longer an |
1626 | * association and that no more packets should be | 1711 | * association and that no more packets should be |
1627 | * sent | 1712 | * sent |
1628 | */ | 1713 | */ |
1629 | priv->staging_rxon.filter_flags &= | 1714 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1630 | ~RXON_FILTER_ASSOC_MSK; | 1715 | ctx->staging.assoc_id = 0; |
1631 | priv->staging_rxon.assoc_id = 0; | 1716 | iwlcore_commit_rxon(priv, ctx); |
1632 | iwlcore_commit_rxon(priv); | ||
1633 | } | 1717 | } |
1634 | 1718 | ||
1635 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | 1719 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) |
@@ -1640,6 +1724,14 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1640 | 1724 | ||
1641 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 1725 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
1642 | 1726 | ||
1727 | lockdep_assert_held(&priv->mutex); | ||
1728 | |||
1729 | if (!priv->beacon_ctx) { | ||
1730 | IWL_ERR(priv, "update beacon but no beacon context!\n"); | ||
1731 | dev_kfree_skb(skb); | ||
1732 | return -EINVAL; | ||
1733 | } | ||
1734 | |||
1643 | if (!iwl_is_ready_rf(priv)) { | 1735 | if (!iwl_is_ready_rf(priv)) { |
1644 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | 1736 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); |
1645 | return -EIO; | 1737 | return -EIO; |
@@ -1658,7 +1750,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1658 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1750 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
1659 | spin_unlock_irqrestore(&priv->lock, flags); | 1751 | spin_unlock_irqrestore(&priv->lock, flags); |
1660 | 1752 | ||
1661 | priv->cfg->ops->lib->post_associate(priv, priv->vif); | 1753 | priv->cfg->ops->lib->post_associate(priv, priv->beacon_ctx->vif); |
1662 | 1754 | ||
1663 | return 0; | 1755 | return 0; |
1664 | } | 1756 | } |
@@ -1669,6 +1761,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1669 | u32 changes) | 1761 | u32 changes) |
1670 | { | 1762 | { |
1671 | struct iwl_priv *priv = hw->priv; | 1763 | struct iwl_priv *priv = hw->priv; |
1764 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | ||
1672 | int ret; | 1765 | int ret; |
1673 | 1766 | ||
1674 | IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); | 1767 | IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); |
@@ -1682,11 +1775,23 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1682 | unsigned long flags; | 1775 | unsigned long flags; |
1683 | 1776 | ||
1684 | spin_lock_irqsave(&priv->lock, flags); | 1777 | spin_lock_irqsave(&priv->lock, flags); |
1685 | priv->qos_data.qos_active = bss_conf->qos; | 1778 | ctx->qos_data.qos_active = bss_conf->qos; |
1686 | iwl_update_qos(priv); | 1779 | iwl_update_qos(priv, ctx); |
1687 | spin_unlock_irqrestore(&priv->lock, flags); | 1780 | spin_unlock_irqrestore(&priv->lock, flags); |
1688 | } | 1781 | } |
1689 | 1782 | ||
1783 | if (changes & BSS_CHANGED_BEACON_ENABLED) { | ||
1784 | /* | ||
1785 | * the add_interface code must make sure we only ever | ||
1786 | * have a single interface that could be beaconing at | ||
1787 | * any time. | ||
1788 | */ | ||
1789 | if (vif->bss_conf.enable_beacon) | ||
1790 | priv->beacon_ctx = ctx; | ||
1791 | else | ||
1792 | priv->beacon_ctx = NULL; | ||
1793 | } | ||
1794 | |||
1690 | if (changes & BSS_CHANGED_BEACON && vif->type == NL80211_IFTYPE_AP) { | 1795 | if (changes & BSS_CHANGED_BEACON && vif->type == NL80211_IFTYPE_AP) { |
1691 | dev_kfree_skb(priv->ibss_beacon); | 1796 | dev_kfree_skb(priv->ibss_beacon); |
1692 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | 1797 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); |
@@ -1713,13 +1818,13 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1713 | 1818 | ||
1714 | /* mac80211 only sets assoc when in STATION mode */ | 1819 | /* mac80211 only sets assoc when in STATION mode */ |
1715 | if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { | 1820 | if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { |
1716 | memcpy(priv->staging_rxon.bssid_addr, | 1821 | memcpy(ctx->staging.bssid_addr, |
1717 | bss_conf->bssid, ETH_ALEN); | 1822 | bss_conf->bssid, ETH_ALEN); |
1718 | 1823 | ||
1719 | /* currently needed in a few places */ | 1824 | /* currently needed in a few places */ |
1720 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 1825 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); |
1721 | } else { | 1826 | } else { |
1722 | priv->staging_rxon.filter_flags &= | 1827 | ctx->staging.filter_flags &= |
1723 | ~RXON_FILTER_ASSOC_MSK; | 1828 | ~RXON_FILTER_ASSOC_MSK; |
1724 | } | 1829 | } |
1725 | 1830 | ||
@@ -1742,21 +1847,21 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1742 | IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", | 1847 | IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", |
1743 | bss_conf->use_short_preamble); | 1848 | bss_conf->use_short_preamble); |
1744 | if (bss_conf->use_short_preamble) | 1849 | if (bss_conf->use_short_preamble) |
1745 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 1850 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
1746 | else | 1851 | else |
1747 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 1852 | ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
1748 | } | 1853 | } |
1749 | 1854 | ||
1750 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | 1855 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { |
1751 | IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", bss_conf->use_cts_prot); | 1856 | IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", bss_conf->use_cts_prot); |
1752 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) | 1857 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) |
1753 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; | 1858 | ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; |
1754 | else | 1859 | else |
1755 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 1860 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
1756 | if (bss_conf->use_cts_prot) | 1861 | if (bss_conf->use_cts_prot) |
1757 | priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; | 1862 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; |
1758 | else | 1863 | else |
1759 | priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN; | 1864 | ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; |
1760 | } | 1865 | } |
1761 | 1866 | ||
1762 | if (changes & BSS_CHANGED_BASIC_RATES) { | 1867 | if (changes & BSS_CHANGED_BASIC_RATES) { |
@@ -1766,12 +1871,12 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1766 | * like this here: | 1871 | * like this here: |
1767 | * | 1872 | * |
1768 | if (A-band) | 1873 | if (A-band) |
1769 | priv->staging_rxon.ofdm_basic_rates = | 1874 | ctx->staging.ofdm_basic_rates = |
1770 | bss_conf->basic_rates; | 1875 | bss_conf->basic_rates; |
1771 | else | 1876 | else |
1772 | priv->staging_rxon.ofdm_basic_rates = | 1877 | ctx->staging.ofdm_basic_rates = |
1773 | bss_conf->basic_rates >> 4; | 1878 | bss_conf->basic_rates >> 4; |
1774 | priv->staging_rxon.cck_basic_rates = | 1879 | ctx->staging.cck_basic_rates = |
1775 | bss_conf->basic_rates & 0xF; | 1880 | bss_conf->basic_rates & 0xF; |
1776 | */ | 1881 | */ |
1777 | } | 1882 | } |
@@ -1780,7 +1885,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1780 | iwl_ht_conf(priv, vif); | 1885 | iwl_ht_conf(priv, vif); |
1781 | 1886 | ||
1782 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1887 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1783 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 1888 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
1784 | } | 1889 | } |
1785 | 1890 | ||
1786 | if (changes & BSS_CHANGED_ASSOC) { | 1891 | if (changes & BSS_CHANGED_ASSOC) { |
@@ -1793,29 +1898,29 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1793 | if (!iwl_is_rfkill(priv)) | 1898 | if (!iwl_is_rfkill(priv)) |
1794 | priv->cfg->ops->lib->post_associate(priv, vif); | 1899 | priv->cfg->ops->lib->post_associate(priv, vif); |
1795 | } else | 1900 | } else |
1796 | iwl_set_no_assoc(priv); | 1901 | iwl_set_no_assoc(priv, vif); |
1797 | } | 1902 | } |
1798 | 1903 | ||
1799 | if (changes && iwl_is_associated(priv) && bss_conf->aid) { | 1904 | if (changes && iwl_is_associated_ctx(ctx) && bss_conf->aid) { |
1800 | IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", | 1905 | IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", |
1801 | changes); | 1906 | changes); |
1802 | ret = iwl_send_rxon_assoc(priv); | 1907 | ret = iwl_send_rxon_assoc(priv, ctx); |
1803 | if (!ret) { | 1908 | if (!ret) { |
1804 | /* Sync active_rxon with latest change. */ | 1909 | /* Sync active_rxon with latest change. */ |
1805 | memcpy((void *)&priv->active_rxon, | 1910 | memcpy((void *)&ctx->active, |
1806 | &priv->staging_rxon, | 1911 | &ctx->staging, |
1807 | sizeof(struct iwl_rxon_cmd)); | 1912 | sizeof(struct iwl_rxon_cmd)); |
1808 | } | 1913 | } |
1809 | } | 1914 | } |
1810 | 1915 | ||
1811 | if (changes & BSS_CHANGED_BEACON_ENABLED) { | 1916 | if (changes & BSS_CHANGED_BEACON_ENABLED) { |
1812 | if (vif->bss_conf.enable_beacon) { | 1917 | if (vif->bss_conf.enable_beacon) { |
1813 | memcpy(priv->staging_rxon.bssid_addr, | 1918 | memcpy(ctx->staging.bssid_addr, |
1814 | bss_conf->bssid, ETH_ALEN); | 1919 | bss_conf->bssid, ETH_ALEN); |
1815 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 1920 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); |
1816 | iwlcore_config_ap(priv, vif); | 1921 | iwlcore_config_ap(priv, vif); |
1817 | } else | 1922 | } else |
1818 | iwl_set_no_assoc(priv); | 1923 | iwl_set_no_assoc(priv, vif); |
1819 | } | 1924 | } |
1820 | 1925 | ||
1821 | if (changes & BSS_CHANGED_IBSS) { | 1926 | if (changes & BSS_CHANGED_IBSS) { |
@@ -1827,6 +1932,12 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
1827 | bss_conf->bssid); | 1932 | bss_conf->bssid); |
1828 | } | 1933 | } |
1829 | 1934 | ||
1935 | if (changes & BSS_CHANGED_IDLE && | ||
1936 | priv->cfg->ops->hcmd->set_pan_params) { | ||
1937 | if (priv->cfg->ops->hcmd->set_pan_params(priv)) | ||
1938 | IWL_ERR(priv, "failed to update PAN params\n"); | ||
1939 | } | ||
1940 | |||
1830 | mutex_unlock(&priv->mutex); | 1941 | mutex_unlock(&priv->mutex); |
1831 | 1942 | ||
1832 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 1943 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -1835,17 +1946,21 @@ EXPORT_SYMBOL(iwl_bss_info_changed); | |||
1835 | 1946 | ||
1836 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) | 1947 | static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif) |
1837 | { | 1948 | { |
1838 | iwl_connection_init_rx_config(priv, vif); | 1949 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); |
1950 | |||
1951 | iwl_connection_init_rx_config(priv, ctx); | ||
1839 | 1952 | ||
1840 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1953 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1841 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 1954 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); |
1842 | 1955 | ||
1843 | return iwlcore_commit_rxon(priv); | 1956 | return iwlcore_commit_rxon(priv, ctx); |
1844 | } | 1957 | } |
1845 | 1958 | ||
1846 | int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 1959 | int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
1847 | { | 1960 | { |
1848 | struct iwl_priv *priv = hw->priv; | 1961 | struct iwl_priv *priv = hw->priv; |
1962 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
1963 | struct iwl_rxon_context *tmp, *ctx = NULL; | ||
1849 | int err = 0; | 1964 | int err = 0; |
1850 | 1965 | ||
1851 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1966 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
@@ -1858,23 +1973,60 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
1858 | goto out; | 1973 | goto out; |
1859 | } | 1974 | } |
1860 | 1975 | ||
1861 | if (priv->vif) { | 1976 | for_each_context(priv, tmp) { |
1862 | IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n"); | 1977 | u32 possible_modes = |
1978 | tmp->interface_modes | tmp->exclusive_interface_modes; | ||
1979 | |||
1980 | if (tmp->vif) { | ||
1981 | /* check if this busy context is exclusive */ | ||
1982 | if (tmp->exclusive_interface_modes & | ||
1983 | BIT(tmp->vif->type)) { | ||
1984 | err = -EINVAL; | ||
1985 | goto out; | ||
1986 | } | ||
1987 | continue; | ||
1988 | } | ||
1989 | |||
1990 | if (!(possible_modes & BIT(vif->type))) | ||
1991 | continue; | ||
1992 | |||
1993 | /* have maybe usable context w/o interface */ | ||
1994 | ctx = tmp; | ||
1995 | break; | ||
1996 | } | ||
1997 | |||
1998 | if (!ctx) { | ||
1863 | err = -EOPNOTSUPP; | 1999 | err = -EOPNOTSUPP; |
1864 | goto out; | 2000 | goto out; |
1865 | } | 2001 | } |
1866 | 2002 | ||
1867 | priv->vif = vif; | 2003 | vif_priv->ctx = ctx; |
2004 | ctx->vif = vif; | ||
2005 | /* | ||
2006 | * This variable will be correct only when there's just | ||
2007 | * a single context, but all code using it is for hardware | ||
2008 | * that supports only one context. | ||
2009 | */ | ||
1868 | priv->iw_mode = vif->type; | 2010 | priv->iw_mode = vif->type; |
1869 | 2011 | ||
1870 | err = iwl_set_mode(priv, vif); | 2012 | err = iwl_set_mode(priv, vif); |
1871 | if (err) | 2013 | if (err) |
1872 | goto out_err; | 2014 | goto out_err; |
1873 | 2015 | ||
2016 | if (priv->cfg->advanced_bt_coexist && | ||
2017 | vif->type == NL80211_IFTYPE_ADHOC) { | ||
2018 | /* | ||
2019 | * pretend to have high BT traffic as long as we | ||
2020 | * are operating in IBSS mode, as this will cause | ||
2021 | * the rate scaling etc. to behave as intended. | ||
2022 | */ | ||
2023 | priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; | ||
2024 | } | ||
2025 | |||
1874 | goto out; | 2026 | goto out; |
1875 | 2027 | ||
1876 | out_err: | 2028 | out_err: |
1877 | priv->vif = NULL; | 2029 | ctx->vif = NULL; |
1878 | priv->iw_mode = NL80211_IFTYPE_STATION; | 2030 | priv->iw_mode = NL80211_IFTYPE_STATION; |
1879 | out: | 2031 | out: |
1880 | mutex_unlock(&priv->mutex); | 2032 | mutex_unlock(&priv->mutex); |
@@ -1888,26 +2040,36 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
1888 | struct ieee80211_vif *vif) | 2040 | struct ieee80211_vif *vif) |
1889 | { | 2041 | { |
1890 | struct iwl_priv *priv = hw->priv; | 2042 | struct iwl_priv *priv = hw->priv; |
2043 | struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); | ||
1891 | bool scan_completed = false; | 2044 | bool scan_completed = false; |
1892 | 2045 | ||
1893 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 2046 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
1894 | 2047 | ||
1895 | mutex_lock(&priv->mutex); | 2048 | mutex_lock(&priv->mutex); |
1896 | 2049 | ||
1897 | if (iwl_is_ready_rf(priv)) { | 2050 | WARN_ON(ctx->vif != vif); |
1898 | iwl_scan_cancel_timeout(priv, 100); | 2051 | ctx->vif = NULL; |
1899 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2052 | |
1900 | iwlcore_commit_rxon(priv); | 2053 | iwl_scan_cancel_timeout(priv, 100); |
1901 | } | 2054 | iwl_set_mode(priv, vif); |
1902 | if (priv->vif == vif) { | 2055 | |
1903 | priv->vif = NULL; | 2056 | if (priv->scan_vif == vif) { |
1904 | if (priv->scan_vif == vif) { | 2057 | scan_completed = true; |
1905 | scan_completed = true; | 2058 | priv->scan_vif = NULL; |
1906 | priv->scan_vif = NULL; | 2059 | priv->scan_request = NULL; |
1907 | priv->scan_request = NULL; | ||
1908 | } | ||
1909 | memset(priv->bssid, 0, ETH_ALEN); | ||
1910 | } | 2060 | } |
2061 | |||
2062 | /* | ||
2063 | * When removing the IBSS interface, overwrite the | ||
2064 | * BT traffic load with the stored one from the last | ||
2065 | * notification, if any. If this is a device that | ||
2066 | * doesn't implement this, this has no effect since | ||
2067 | * both values are the same and zero. | ||
2068 | */ | ||
2069 | if (vif->type == NL80211_IFTYPE_ADHOC) | ||
2070 | priv->bt_traffic_load = priv->notif_bt_traffic_load; | ||
2071 | |||
2072 | memset(priv->bssid, 0, ETH_ALEN); | ||
1911 | mutex_unlock(&priv->mutex); | 2073 | mutex_unlock(&priv->mutex); |
1912 | 2074 | ||
1913 | if (scan_completed) | 2075 | if (scan_completed) |
@@ -1928,6 +2090,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
1928 | struct ieee80211_conf *conf = &hw->conf; | 2090 | struct ieee80211_conf *conf = &hw->conf; |
1929 | struct ieee80211_channel *channel = conf->channel; | 2091 | struct ieee80211_channel *channel = conf->channel; |
1930 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | 2092 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; |
2093 | struct iwl_rxon_context *ctx; | ||
1931 | unsigned long flags = 0; | 2094 | unsigned long flags = 0; |
1932 | int ret = 0; | 2095 | int ret = 0; |
1933 | u16 ch; | 2096 | u16 ch; |
@@ -1957,7 +2120,8 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
1957 | * configured. | 2120 | * configured. |
1958 | */ | 2121 | */ |
1959 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2122 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1960 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2123 | for_each_context(priv, ctx) |
2124 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | ||
1961 | } | 2125 | } |
1962 | 2126 | ||
1963 | /* during scanning mac80211 will delay channel setting until | 2127 | /* during scanning mac80211 will delay channel setting until |
@@ -1977,39 +2141,49 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
1977 | 2141 | ||
1978 | spin_lock_irqsave(&priv->lock, flags); | 2142 | spin_lock_irqsave(&priv->lock, flags); |
1979 | 2143 | ||
1980 | /* Configure HT40 channels */ | 2144 | for_each_context(priv, ctx) { |
1981 | ht_conf->is_ht = conf_is_ht(conf); | 2145 | /* Configure HT40 channels */ |
1982 | if (ht_conf->is_ht) { | 2146 | ctx->ht.enabled = conf_is_ht(conf); |
1983 | if (conf_is_ht40_minus(conf)) { | 2147 | if (ctx->ht.enabled) { |
1984 | ht_conf->extension_chan_offset = | 2148 | if (conf_is_ht40_minus(conf)) { |
1985 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | 2149 | ctx->ht.extension_chan_offset = |
1986 | ht_conf->is_40mhz = true; | 2150 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; |
1987 | } else if (conf_is_ht40_plus(conf)) { | 2151 | ctx->ht.is_40mhz = true; |
1988 | ht_conf->extension_chan_offset = | 2152 | } else if (conf_is_ht40_plus(conf)) { |
1989 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | 2153 | ctx->ht.extension_chan_offset = |
1990 | ht_conf->is_40mhz = true; | 2154 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; |
1991 | } else { | 2155 | ctx->ht.is_40mhz = true; |
1992 | ht_conf->extension_chan_offset = | 2156 | } else { |
1993 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | 2157 | ctx->ht.extension_chan_offset = |
1994 | ht_conf->is_40mhz = false; | 2158 | IEEE80211_HT_PARAM_CHA_SEC_NONE; |
1995 | } | 2159 | ctx->ht.is_40mhz = false; |
1996 | } else | 2160 | } |
1997 | ht_conf->is_40mhz = false; | 2161 | } else |
1998 | /* Default to no protection. Protection mode will later be set | 2162 | ctx->ht.is_40mhz = false; |
1999 | * from BSS config in iwl_ht_conf */ | ||
2000 | ht_conf->ht_protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE; | ||
2001 | 2163 | ||
2002 | if ((le16_to_cpu(priv->staging_rxon.channel) != ch)) | 2164 | /* |
2003 | priv->staging_rxon.flags = 0; | 2165 | * Default to no protection. Protection mode will |
2166 | * later be set from BSS config in iwl_ht_conf | ||
2167 | */ | ||
2168 | ctx->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE; | ||
2169 | |||
2170 | /* if we are switching from ht to 2.4 clear flags | ||
2171 | * from any ht related info since 2.4 does not | ||
2172 | * support ht */ | ||
2173 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | ||
2174 | ctx->staging.flags = 0; | ||
2175 | |||
2176 | iwl_set_rxon_channel(priv, channel, ctx); | ||
2177 | iwl_set_rxon_ht(priv, ht_conf); | ||
2004 | 2178 | ||
2005 | iwl_set_rxon_channel(priv, channel); | 2179 | iwl_set_flags_for_band(priv, ctx, channel->band, |
2006 | iwl_set_rxon_ht(priv, ht_conf); | 2180 | ctx->vif); |
2181 | } | ||
2007 | 2182 | ||
2008 | iwl_set_flags_for_band(priv, channel->band, priv->vif); | ||
2009 | spin_unlock_irqrestore(&priv->lock, flags); | 2183 | spin_unlock_irqrestore(&priv->lock, flags); |
2010 | 2184 | ||
2011 | if (priv->cfg->ops->lib->update_bcast_station) | 2185 | if (priv->cfg->ops->lib->update_bcast_stations) |
2012 | ret = priv->cfg->ops->lib->update_bcast_station(priv); | 2186 | ret = priv->cfg->ops->lib->update_bcast_stations(priv); |
2013 | 2187 | ||
2014 | set_ch_out: | 2188 | set_ch_out: |
2015 | /* The list of supported rates and rate mask can be different | 2189 | /* The list of supported rates and rate mask can be different |
@@ -2040,12 +2214,13 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2040 | if (scan_active) | 2214 | if (scan_active) |
2041 | goto out; | 2215 | goto out; |
2042 | 2216 | ||
2043 | if (memcmp(&priv->active_rxon, | 2217 | for_each_context(priv, ctx) { |
2044 | &priv->staging_rxon, sizeof(priv->staging_rxon))) | 2218 | if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) |
2045 | iwlcore_commit_rxon(priv); | 2219 | iwlcore_commit_rxon(priv, ctx); |
2046 | else | 2220 | else |
2047 | IWL_DEBUG_INFO(priv, "Not re-sending same RXON configuration.\n"); | 2221 | IWL_DEBUG_INFO(priv, |
2048 | 2222 | "Not re-sending same RXON configuration.\n"); | |
2223 | } | ||
2049 | 2224 | ||
2050 | out: | 2225 | out: |
2051 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 2226 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -2058,6 +2233,8 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
2058 | { | 2233 | { |
2059 | struct iwl_priv *priv = hw->priv; | 2234 | struct iwl_priv *priv = hw->priv; |
2060 | unsigned long flags; | 2235 | unsigned long flags; |
2236 | /* IBSS can only be the IWL_RXON_CTX_BSS context */ | ||
2237 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
2061 | 2238 | ||
2062 | mutex_lock(&priv->mutex); | 2239 | mutex_lock(&priv->mutex); |
2063 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 2240 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
@@ -2088,8 +2265,8 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | |||
2088 | * clear RXON_FILTER_ASSOC_MSK bit | 2265 | * clear RXON_FILTER_ASSOC_MSK bit |
2089 | */ | 2266 | */ |
2090 | iwl_scan_cancel_timeout(priv, 100); | 2267 | iwl_scan_cancel_timeout(priv, 100); |
2091 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2268 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2092 | iwlcore_commit_rxon(priv); | 2269 | iwlcore_commit_rxon(priv, ctx); |
2093 | 2270 | ||
2094 | iwl_set_rate(priv); | 2271 | iwl_set_rate(priv); |
2095 | 2272 | ||
@@ -2498,7 +2675,7 @@ static void iwl_force_rf_reset(struct iwl_priv *priv) | |||
2498 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2675 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2499 | return; | 2676 | return; |
2500 | 2677 | ||
2501 | if (!iwl_is_associated(priv)) { | 2678 | if (!iwl_is_any_associated(priv)) { |
2502 | IWL_DEBUG_SCAN(priv, "force reset rejected: not associated\n"); | 2679 | IWL_DEBUG_SCAN(priv, "force reset rejected: not associated\n"); |
2503 | return; | 2680 | return; |
2504 | } | 2681 | } |
@@ -2624,10 +2801,14 @@ static int iwl_check_stuck_queue(struct iwl_priv *priv, int cnt) | |||
2624 | "queue %d, not read %d time\n", | 2801 | "queue %d, not read %d time\n", |
2625 | q->id, | 2802 | q->id, |
2626 | q->repeat_same_read_ptr); | 2803 | q->repeat_same_read_ptr); |
2627 | mod_timer(&priv->monitor_recover, jiffies + | 2804 | if (!priv->cfg->advanced_bt_coexist) { |
2628 | msecs_to_jiffies(IWL_ONE_HUNDRED_MSECS)); | 2805 | mod_timer(&priv->monitor_recover, |
2806 | jiffies + msecs_to_jiffies( | ||
2807 | IWL_ONE_HUNDRED_MSECS)); | ||
2808 | return 1; | ||
2809 | } | ||
2629 | } | 2810 | } |
2630 | return 1; | 2811 | return 0; |
2631 | } else { | 2812 | } else { |
2632 | q->last_read_ptr = q->read_ptr; | 2813 | q->last_read_ptr = q->read_ptr; |
2633 | q->repeat_same_read_ptr = 0; | 2814 | q->repeat_same_read_ptr = 0; |
@@ -2645,25 +2826,27 @@ void iwl_bg_monitor_recover(unsigned long data) | |||
2645 | return; | 2826 | return; |
2646 | 2827 | ||
2647 | /* monitor and check for stuck cmd queue */ | 2828 | /* monitor and check for stuck cmd queue */ |
2648 | if (iwl_check_stuck_queue(priv, IWL_CMD_QUEUE_NUM)) | 2829 | if (iwl_check_stuck_queue(priv, priv->cmd_queue)) |
2649 | return; | 2830 | return; |
2650 | 2831 | ||
2651 | /* monitor and check for other stuck queues */ | 2832 | /* monitor and check for other stuck queues */ |
2652 | if (iwl_is_associated(priv)) { | 2833 | if (iwl_is_any_associated(priv)) { |
2653 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { | 2834 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { |
2654 | /* skip as we already checked the command queue */ | 2835 | /* skip as we already checked the command queue */ |
2655 | if (cnt == IWL_CMD_QUEUE_NUM) | 2836 | if (cnt == priv->cmd_queue) |
2656 | continue; | 2837 | continue; |
2657 | if (iwl_check_stuck_queue(priv, cnt)) | 2838 | if (iwl_check_stuck_queue(priv, cnt)) |
2658 | return; | 2839 | return; |
2659 | } | 2840 | } |
2660 | } | 2841 | } |
2661 | /* | 2842 | if (priv->cfg->monitor_recover_period) { |
2662 | * Reschedule the timer to occur in | 2843 | /* |
2663 | * priv->cfg->monitor_recover_period | 2844 | * Reschedule the timer to occur in |
2664 | */ | 2845 | * priv->cfg->monitor_recover_period |
2665 | mod_timer(&priv->monitor_recover, | 2846 | */ |
2666 | jiffies + msecs_to_jiffies(priv->cfg->monitor_recover_period)); | 2847 | mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies( |
2848 | priv->cfg->monitor_recover_period)); | ||
2849 | } | ||
2667 | } | 2850 | } |
2668 | EXPORT_SYMBOL(iwl_bg_monitor_recover); | 2851 | EXPORT_SYMBOL(iwl_bg_monitor_recover); |
2669 | 2852 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 7b1e832bae56..f7b57ed84f66 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -88,11 +88,13 @@ struct iwl_cmd; | |||
88 | #define IWL_CMD(x) case x: return #x | 88 | #define IWL_CMD(x) case x: return #x |
89 | 89 | ||
90 | struct iwl_hcmd_ops { | 90 | struct iwl_hcmd_ops { |
91 | int (*rxon_assoc)(struct iwl_priv *priv); | 91 | int (*rxon_assoc)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
92 | int (*commit_rxon)(struct iwl_priv *priv); | 92 | int (*commit_rxon)(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
93 | void (*set_rxon_chain)(struct iwl_priv *priv); | 93 | void (*set_rxon_chain)(struct iwl_priv *priv, |
94 | struct iwl_rxon_context *ctx); | ||
94 | int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); | 95 | int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); |
95 | void (*send_bt_config)(struct iwl_priv *priv); | 96 | void (*send_bt_config)(struct iwl_priv *priv); |
97 | int (*set_pan_params)(struct iwl_priv *priv); | ||
96 | }; | 98 | }; |
97 | 99 | ||
98 | struct iwl_hcmd_utils_ops { | 100 | struct iwl_hcmd_utils_ops { |
@@ -205,7 +207,7 @@ struct iwl_lib_ops { | |||
205 | /* station management */ | 207 | /* station management */ |
206 | int (*manage_ibss_station)(struct iwl_priv *priv, | 208 | int (*manage_ibss_station)(struct iwl_priv *priv, |
207 | struct ieee80211_vif *vif, bool add); | 209 | struct ieee80211_vif *vif, bool add); |
208 | int (*update_bcast_station)(struct iwl_priv *priv); | 210 | int (*update_bcast_stations)(struct iwl_priv *priv); |
209 | /* recover from tx queue stall */ | 211 | /* recover from tx queue stall */ |
210 | void (*recover_from_tx_stall)(unsigned long data); | 212 | void (*recover_from_tx_stall)(unsigned long data); |
211 | /* check for plcp health */ | 213 | /* check for plcp health */ |
@@ -278,6 +280,9 @@ struct iwl_mod_params { | |||
278 | * @chain_noise_calib_by_driver: driver has the capability to perform | 280 | * @chain_noise_calib_by_driver: driver has the capability to perform |
279 | * chain noise calibration operation | 281 | * chain noise calibration operation |
280 | * @scan_antennas: available antenna for scan operation | 282 | * @scan_antennas: available antenna for scan operation |
283 | * @advanced_bt_coexist: support advanced bt coexist | ||
284 | * @bt_init_traffic_load: specify initial bt traffic load | ||
285 | * @bt_prio_boost: default bt priority boost value | ||
281 | * @need_dc_calib: need to perform init dc calibration | 286 | * @need_dc_calib: need to perform init dc calibration |
282 | * @bt_statistics: use BT version of statistics notification | 287 | * @bt_statistics: use BT version of statistics notification |
283 | * @agg_time_limit: maximum number of uSec in aggregation | 288 | * @agg_time_limit: maximum number of uSec in aggregation |
@@ -351,6 +356,9 @@ struct iwl_cfg { | |||
351 | const bool chain_noise_calib_by_driver; | 356 | const bool chain_noise_calib_by_driver; |
352 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; | 357 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; |
353 | u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; | 358 | u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; |
359 | bool advanced_bt_coexist; | ||
360 | u8 bt_init_traffic_load; | ||
361 | u8 bt_prio_boost; | ||
354 | const bool need_dc_calib; | 362 | const bool need_dc_calib; |
355 | const bool bt_statistics; | 363 | const bool bt_statistics; |
356 | u16 agg_time_limit; | 364 | u16 agg_time_limit; |
@@ -368,21 +376,25 @@ void iwl_activate_qos(struct iwl_priv *priv); | |||
368 | int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | 376 | int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, |
369 | const struct ieee80211_tx_queue_params *params); | 377 | const struct ieee80211_tx_queue_params *params); |
370 | int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw); | 378 | int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw); |
371 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt); | 379 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
372 | int iwl_check_rxon_cmd(struct iwl_priv *priv); | 380 | int hw_decrypt); |
373 | int iwl_full_rxon_required(struct iwl_priv *priv); | 381 | int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
374 | void iwl_set_rxon_chain(struct iwl_priv *priv); | 382 | int iwl_full_rxon_required(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
375 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); | 383 | void iwl_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
384 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, | ||
385 | struct iwl_rxon_context *ctx); | ||
376 | void iwl_set_flags_for_band(struct iwl_priv *priv, | 386 | void iwl_set_flags_for_band(struct iwl_priv *priv, |
387 | struct iwl_rxon_context *ctx, | ||
377 | enum ieee80211_band band, | 388 | enum ieee80211_band band, |
378 | struct ieee80211_vif *vif); | 389 | struct ieee80211_vif *vif); |
379 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, | 390 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, |
380 | enum ieee80211_band band); | 391 | enum ieee80211_band band); |
381 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); | 392 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); |
382 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, | 393 | bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
383 | struct ieee80211_sta_ht_cap *sta_ht_inf); | 394 | struct iwl_rxon_context *ctx, |
395 | struct ieee80211_sta_ht_cap *ht_cap); | ||
384 | void iwl_connection_init_rx_config(struct iwl_priv *priv, | 396 | void iwl_connection_init_rx_config(struct iwl_priv *priv, |
385 | struct ieee80211_vif *vif); | 397 | struct iwl_rxon_context *ctx); |
386 | void iwl_set_rate(struct iwl_priv *priv); | 398 | void iwl_set_rate(struct iwl_priv *priv); |
387 | int iwl_set_decrypted_flag(struct iwl_priv *priv, | 399 | int iwl_set_decrypted_flag(struct iwl_priv *priv, |
388 | struct ieee80211_hdr *hdr, | 400 | struct ieee80211_hdr *hdr, |
@@ -394,7 +406,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, | |||
394 | struct ieee80211_vif *vif, | 406 | struct ieee80211_vif *vif, |
395 | struct ieee80211_bss_conf *bss_conf, | 407 | struct ieee80211_bss_conf *bss_conf, |
396 | u32 changes); | 408 | u32 changes); |
397 | int iwl_commit_rxon(struct iwl_priv *priv); | 409 | int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
398 | int iwl_mac_add_interface(struct ieee80211_hw *hw, | 410 | int iwl_mac_add_interface(struct ieee80211_hw *hw, |
399 | struct ieee80211_vif *vif); | 411 | struct ieee80211_vif *vif); |
400 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, | 412 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, |
@@ -512,7 +524,8 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); | |||
512 | 524 | ||
513 | int iwl_hwrate_to_plcp_idx(u32 rate_n_flags); | 525 | int iwl_hwrate_to_plcp_idx(u32 rate_n_flags); |
514 | 526 | ||
515 | u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv); | 527 | u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv, |
528 | struct iwl_rxon_context *ctx); | ||
516 | 529 | ||
517 | u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid); | 530 | u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid); |
518 | 531 | ||
@@ -626,9 +639,11 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, | |||
626 | void iwl_dump_csr(struct iwl_priv *priv); | 639 | void iwl_dump_csr(struct iwl_priv *priv); |
627 | int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display); | 640 | int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display); |
628 | #ifdef CONFIG_IWLWIFI_DEBUG | 641 | #ifdef CONFIG_IWLWIFI_DEBUG |
629 | void iwl_print_rx_config_cmd(struct iwl_priv *priv); | 642 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
643 | struct iwl_rxon_context *ctx); | ||
630 | #else | 644 | #else |
631 | static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv) | 645 | static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
646 | struct iwl_rxon_context *ctx) | ||
632 | { | 647 | { |
633 | } | 648 | } |
634 | #endif | 649 | #endif |
@@ -708,19 +723,21 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv) | |||
708 | extern void iwl_send_bt_config(struct iwl_priv *priv); | 723 | extern void iwl_send_bt_config(struct iwl_priv *priv); |
709 | extern int iwl_send_statistics_request(struct iwl_priv *priv, | 724 | extern int iwl_send_statistics_request(struct iwl_priv *priv, |
710 | u8 flags, bool clear); | 725 | u8 flags, bool clear); |
711 | extern int iwl_send_lq_cmd(struct iwl_priv *priv, | 726 | extern int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
712 | struct iwl_link_quality_cmd *lq, u8 flags, bool init); | 727 | struct iwl_link_quality_cmd *lq, u8 flags, bool init); |
713 | void iwl_apm_stop(struct iwl_priv *priv); | 728 | void iwl_apm_stop(struct iwl_priv *priv); |
714 | int iwl_apm_init(struct iwl_priv *priv); | 729 | int iwl_apm_init(struct iwl_priv *priv); |
715 | 730 | ||
716 | int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); | 731 | int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
717 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) | 732 | static inline int iwl_send_rxon_assoc(struct iwl_priv *priv, |
733 | struct iwl_rxon_context *ctx) | ||
718 | { | 734 | { |
719 | return priv->cfg->ops->hcmd->rxon_assoc(priv); | 735 | return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx); |
720 | } | 736 | } |
721 | static inline int iwlcore_commit_rxon(struct iwl_priv *priv) | 737 | static inline int iwlcore_commit_rxon(struct iwl_priv *priv, |
738 | struct iwl_rxon_context *ctx) | ||
722 | { | 739 | { |
723 | return priv->cfg->ops->hcmd->commit_rxon(priv); | 740 | return priv->cfg->ops->hcmd->commit_rxon(priv, ctx); |
724 | } | 741 | } |
725 | static inline void iwlcore_config_ap(struct iwl_priv *priv, | 742 | static inline void iwlcore_config_ap(struct iwl_priv *priv, |
726 | struct ieee80211_vif *vif) | 743 | struct ieee80211_vif *vif) |
@@ -732,4 +749,8 @@ static inline const struct ieee80211_supported_band *iwl_get_hw_mode( | |||
732 | { | 749 | { |
733 | return priv->hw->wiphy->bands[band]; | 750 | return priv->hw->wiphy->bands[band]; |
734 | } | 751 | } |
752 | |||
753 | extern bool bt_coex_active; | ||
754 | extern bool bt_siso_mode; | ||
755 | |||
735 | #endif /* __iwl_core_h__ */ | 756 | #endif /* __iwl_core_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index d3acdae72381..0ee8f516c4ab 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -643,19 +643,25 @@ static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf, | |||
643 | size_t count, loff_t *ppos) | 643 | size_t count, loff_t *ppos) |
644 | { | 644 | { |
645 | struct iwl_priv *priv = file->private_data; | 645 | struct iwl_priv *priv = file->private_data; |
646 | struct iwl_rxon_context *ctx; | ||
646 | int pos = 0, i; | 647 | int pos = 0, i; |
647 | char buf[256]; | 648 | char buf[256 * NUM_IWL_RXON_CTX]; |
648 | const size_t bufsz = sizeof(buf); | 649 | const size_t bufsz = sizeof(buf); |
649 | 650 | ||
650 | for (i = 0; i < AC_NUM; i++) { | 651 | for_each_context(priv, ctx) { |
651 | pos += scnprintf(buf + pos, bufsz - pos, | 652 | pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n", |
652 | "\tcw_min\tcw_max\taifsn\ttxop\n"); | 653 | ctx->ctxid); |
653 | pos += scnprintf(buf + pos, bufsz - pos, | 654 | for (i = 0; i < AC_NUM; i++) { |
655 | pos += scnprintf(buf + pos, bufsz - pos, | ||
656 | "\tcw_min\tcw_max\taifsn\ttxop\n"); | ||
657 | pos += scnprintf(buf + pos, bufsz - pos, | ||
654 | "AC[%d]\t%u\t%u\t%u\t%u\n", i, | 658 | "AC[%d]\t%u\t%u\t%u\t%u\n", i, |
655 | priv->qos_data.def_qos_parm.ac[i].cw_min, | 659 | ctx->qos_data.def_qos_parm.ac[i].cw_min, |
656 | priv->qos_data.def_qos_parm.ac[i].cw_max, | 660 | ctx->qos_data.def_qos_parm.ac[i].cw_max, |
657 | priv->qos_data.def_qos_parm.ac[i].aifsn, | 661 | ctx->qos_data.def_qos_parm.ac[i].aifsn, |
658 | priv->qos_data.def_qos_parm.ac[i].edca_txop); | 662 | ctx->qos_data.def_qos_parm.ac[i].edca_txop); |
663 | } | ||
664 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); | ||
659 | } | 665 | } |
660 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 666 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
661 | } | 667 | } |
@@ -730,7 +736,7 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, | |||
730 | return -EFAULT; | 736 | return -EFAULT; |
731 | if (sscanf(buf, "%d", &ht40) != 1) | 737 | if (sscanf(buf, "%d", &ht40) != 1) |
732 | return -EFAULT; | 738 | return -EFAULT; |
733 | if (!iwl_is_associated(priv)) | 739 | if (!iwl_is_any_associated(priv)) |
734 | priv->disable_ht40 = ht40 ? true : false; | 740 | priv->disable_ht40 = ht40 ? true : false; |
735 | else { | 741 | else { |
736 | IWL_ERR(priv, "Sta associated with AP - " | 742 | IWL_ERR(priv, "Sta associated with AP - " |
@@ -1319,7 +1325,8 @@ static ssize_t iwl_dbgfs_rxon_flags_read(struct file *file, | |||
1319 | int len = 0; | 1325 | int len = 0; |
1320 | char buf[20]; | 1326 | char buf[20]; |
1321 | 1327 | ||
1322 | len = sprintf(buf, "0x%04X\n", le32_to_cpu(priv->active_rxon.flags)); | 1328 | len = sprintf(buf, "0x%04X\n", |
1329 | le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.flags)); | ||
1323 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 1330 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1324 | } | 1331 | } |
1325 | 1332 | ||
@@ -1332,7 +1339,7 @@ static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file, | |||
1332 | char buf[20]; | 1339 | char buf[20]; |
1333 | 1340 | ||
1334 | len = sprintf(buf, "0x%04X\n", | 1341 | len = sprintf(buf, "0x%04X\n", |
1335 | le32_to_cpu(priv->active_rxon.filter_flags)); | 1342 | le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags)); |
1336 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 1343 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1337 | } | 1344 | } |
1338 | 1345 | ||
@@ -1527,6 +1534,76 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, | |||
1527 | user_buf, count, ppos); | 1534 | user_buf, count, ppos); |
1528 | } | 1535 | } |
1529 | 1536 | ||
1537 | static ssize_t iwl_dbgfs_monitor_period_write(struct file *file, | ||
1538 | const char __user *user_buf, | ||
1539 | size_t count, loff_t *ppos) { | ||
1540 | |||
1541 | struct iwl_priv *priv = file->private_data; | ||
1542 | char buf[8]; | ||
1543 | int buf_size; | ||
1544 | int period; | ||
1545 | |||
1546 | memset(buf, 0, sizeof(buf)); | ||
1547 | buf_size = min(count, sizeof(buf) - 1); | ||
1548 | if (copy_from_user(buf, user_buf, buf_size)) | ||
1549 | return -EFAULT; | ||
1550 | if (sscanf(buf, "%d", &period) != 1) | ||
1551 | return -EINVAL; | ||
1552 | if (period < 0 || period > IWL_MAX_MONITORING_PERIOD) | ||
1553 | priv->cfg->monitor_recover_period = IWL_DEF_MONITORING_PERIOD; | ||
1554 | else | ||
1555 | priv->cfg->monitor_recover_period = period; | ||
1556 | |||
1557 | if (priv->cfg->monitor_recover_period) | ||
1558 | mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies( | ||
1559 | priv->cfg->monitor_recover_period)); | ||
1560 | else | ||
1561 | del_timer_sync(&priv->monitor_recover); | ||
1562 | return count; | ||
1563 | } | ||
1564 | |||
1565 | static ssize_t iwl_dbgfs_bt_traffic_read(struct file *file, | ||
1566 | char __user *user_buf, | ||
1567 | size_t count, loff_t *ppos) { | ||
1568 | |||
1569 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
1570 | int pos = 0; | ||
1571 | char buf[200]; | ||
1572 | const size_t bufsz = sizeof(buf); | ||
1573 | ssize_t ret; | ||
1574 | |||
1575 | pos += scnprintf(buf + pos, bufsz - pos, "BT in %s mode\n", | ||
1576 | priv->bt_full_concurrent ? "full concurrency" : "3-wire"); | ||
1577 | pos += scnprintf(buf + pos, bufsz - pos, "BT status: %s, " | ||
1578 | "last traffic notif: %d\n", | ||
1579 | priv->bt_status ? "On" : "Off", priv->notif_bt_traffic_load); | ||
1580 | pos += scnprintf(buf + pos, bufsz - pos, "ch_announcement: %d, " | ||
1581 | "sco_active: %d, kill_ack_mask: %x, " | ||
1582 | "kill_cts_mask: %x\n", | ||
1583 | priv->bt_ch_announce, priv->bt_sco_active, | ||
1584 | priv->kill_ack_mask, priv->kill_cts_mask); | ||
1585 | |||
1586 | pos += scnprintf(buf + pos, bufsz - pos, "bluetooth traffic load: "); | ||
1587 | switch (priv->bt_traffic_load) { | ||
1588 | case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: | ||
1589 | pos += scnprintf(buf + pos, bufsz - pos, "Continuous\n"); | ||
1590 | break; | ||
1591 | case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: | ||
1592 | pos += scnprintf(buf + pos, bufsz - pos, "High\n"); | ||
1593 | break; | ||
1594 | case IWL_BT_COEX_TRAFFIC_LOAD_LOW: | ||
1595 | pos += scnprintf(buf + pos, bufsz - pos, "Low\n"); | ||
1596 | break; | ||
1597 | case IWL_BT_COEX_TRAFFIC_LOAD_NONE: | ||
1598 | default: | ||
1599 | pos += scnprintf(buf + pos, bufsz - pos, "None\n"); | ||
1600 | break; | ||
1601 | } | ||
1602 | |||
1603 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1604 | return ret; | ||
1605 | } | ||
1606 | |||
1530 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 1607 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
1531 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 1608 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
1532 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 1609 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
@@ -1550,6 +1627,8 @@ DEBUGFS_READ_FILE_OPS(rxon_flags); | |||
1550 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); | 1627 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); |
1551 | DEBUGFS_WRITE_FILE_OPS(txfifo_flush); | 1628 | DEBUGFS_WRITE_FILE_OPS(txfifo_flush); |
1552 | DEBUGFS_READ_FILE_OPS(ucode_bt_stats); | 1629 | DEBUGFS_READ_FILE_OPS(ucode_bt_stats); |
1630 | DEBUGFS_WRITE_FILE_OPS(monitor_period); | ||
1631 | DEBUGFS_READ_FILE_OPS(bt_traffic); | ||
1553 | 1632 | ||
1554 | /* | 1633 | /* |
1555 | * Create the debugfs files and directories | 1634 | * Create the debugfs files and directories |
@@ -1621,6 +1700,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1621 | DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); | 1700 | DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); |
1622 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1701 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1623 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1702 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1703 | DEBUGFS_ADD_FILE(monitor_period, dir_debug, S_IWUSR); | ||
1704 | if (priv->cfg->advanced_bt_coexist) | ||
1705 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); | ||
1624 | if (priv->cfg->sensitivity_calib_by_driver) | 1706 | if (priv->cfg->sensitivity_calib_by_driver) |
1625 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, | 1707 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, |
1626 | &priv->disable_sens_cal); | 1708 | &priv->disable_sens_cal); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 1ad330342ffc..4dd38b7b8b74 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -144,6 +144,7 @@ struct iwl_queue { | |||
144 | /* One for each TFD */ | 144 | /* One for each TFD */ |
145 | struct iwl_tx_info { | 145 | struct iwl_tx_info { |
146 | struct sk_buff *skb; | 146 | struct sk_buff *skb; |
147 | struct iwl_rxon_context *ctx; | ||
147 | }; | 148 | }; |
148 | 149 | ||
149 | /** | 150 | /** |
@@ -253,10 +254,14 @@ struct iwl_channel_info { | |||
253 | struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; | 254 | struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; |
254 | }; | 255 | }; |
255 | 256 | ||
256 | #define IWL_TX_FIFO_BK 0 | 257 | #define IWL_TX_FIFO_BK 0 /* shared */ |
257 | #define IWL_TX_FIFO_BE 1 | 258 | #define IWL_TX_FIFO_BE 1 |
258 | #define IWL_TX_FIFO_VI 2 | 259 | #define IWL_TX_FIFO_VI 2 /* shared */ |
259 | #define IWL_TX_FIFO_VO 3 | 260 | #define IWL_TX_FIFO_VO 3 |
261 | #define IWL_TX_FIFO_BK_IPAN IWL_TX_FIFO_BK | ||
262 | #define IWL_TX_FIFO_BE_IPAN 4 | ||
263 | #define IWL_TX_FIFO_VI_IPAN IWL_TX_FIFO_VI | ||
264 | #define IWL_TX_FIFO_VO_IPAN 5 | ||
260 | #define IWL_TX_FIFO_UNUSED -1 | 265 | #define IWL_TX_FIFO_UNUSED -1 |
261 | 266 | ||
262 | /* Minimum number of queues. MAX_NUM is defined in hw specific files. | 267 | /* Minimum number of queues. MAX_NUM is defined in hw specific files. |
@@ -265,11 +270,17 @@ struct iwl_channel_info { | |||
265 | #define IWL_MIN_NUM_QUEUES 10 | 270 | #define IWL_MIN_NUM_QUEUES 10 |
266 | 271 | ||
267 | /* | 272 | /* |
268 | * Queue #4 is the command queue for 3945/4965/5x00/1000/6x00, | 273 | * Command queue depends on iPAN support. |
269 | * the driver maps it into the appropriate device FIFO for the | ||
270 | * uCode. | ||
271 | */ | 274 | */ |
272 | #define IWL_CMD_QUEUE_NUM 4 | 275 | #define IWL_DEFAULT_CMD_QUEUE_NUM 4 |
276 | #define IWL_IPAN_CMD_QUEUE_NUM 9 | ||
277 | |||
278 | /* | ||
279 | * This queue number is required for proper operation | ||
280 | * because the ucode will stop/start the scheduler as | ||
281 | * required. | ||
282 | */ | ||
283 | #define IWL_IPAN_MCAST_QUEUE 8 | ||
273 | 284 | ||
274 | /* Power management (not Tx power) structures */ | 285 | /* Power management (not Tx power) structures */ |
275 | 286 | ||
@@ -459,15 +470,8 @@ union iwl_ht_rate_supp { | |||
459 | #define CFG_HT_MPDU_DENSITY_MIN (0x1) | 470 | #define CFG_HT_MPDU_DENSITY_MIN (0x1) |
460 | 471 | ||
461 | struct iwl_ht_config { | 472 | struct iwl_ht_config { |
462 | /* self configuration data */ | ||
463 | bool is_ht; | ||
464 | bool is_40mhz; | ||
465 | bool single_chain_sufficient; | 473 | bool single_chain_sufficient; |
466 | enum ieee80211_smps_mode smps; /* current smps mode */ | 474 | enum ieee80211_smps_mode smps; /* current smps mode */ |
467 | /* BSS related data */ | ||
468 | u8 extension_chan_offset; | ||
469 | u8 ht_protection; | ||
470 | u8 non_GF_STA_present; | ||
471 | }; | 475 | }; |
472 | 476 | ||
473 | /* QoS structures */ | 477 | /* QoS structures */ |
@@ -485,12 +489,13 @@ struct iwl_qos_info { | |||
485 | struct iwl_station_entry { | 489 | struct iwl_station_entry { |
486 | struct iwl_addsta_cmd sta; | 490 | struct iwl_addsta_cmd sta; |
487 | struct iwl_tid_data tid[MAX_TID_COUNT]; | 491 | struct iwl_tid_data tid[MAX_TID_COUNT]; |
488 | u8 used; | 492 | u8 used, ctxid; |
489 | struct iwl_hw_key keyinfo; | 493 | struct iwl_hw_key keyinfo; |
490 | struct iwl_link_quality_cmd *lq; | 494 | struct iwl_link_quality_cmd *lq; |
491 | }; | 495 | }; |
492 | 496 | ||
493 | struct iwl_station_priv_common { | 497 | struct iwl_station_priv_common { |
498 | struct iwl_rxon_context *ctx; | ||
494 | u8 sta_id; | 499 | u8 sta_id; |
495 | }; | 500 | }; |
496 | 501 | ||
@@ -519,6 +524,7 @@ struct iwl_station_priv { | |||
519 | * space for us to put data into. | 524 | * space for us to put data into. |
520 | */ | 525 | */ |
521 | struct iwl_vif_priv { | 526 | struct iwl_vif_priv { |
527 | struct iwl_rxon_context *ctx; | ||
522 | u8 ibss_bssid_sta_id; | 528 | u8 ibss_bssid_sta_id; |
523 | }; | 529 | }; |
524 | 530 | ||
@@ -576,6 +582,7 @@ enum iwl_ucode_tlv_type { | |||
576 | IWL_UCODE_TLV_INIT_DATA = 4, | 582 | IWL_UCODE_TLV_INIT_DATA = 4, |
577 | IWL_UCODE_TLV_BOOT = 5, | 583 | IWL_UCODE_TLV_BOOT = 5, |
578 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ | 584 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ |
585 | IWL_UCODE_TLV_PAN = 7, | ||
579 | IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, | 586 | IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, |
580 | IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, | 587 | IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, |
581 | IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, | 588 | IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, |
@@ -670,7 +677,6 @@ struct iwl_sensitivity_ranges { | |||
670 | * @rx_page_order: Rx buffer page order | 677 | * @rx_page_order: Rx buffer page order |
671 | * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR | 678 | * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR |
672 | * @max_stations: | 679 | * @max_stations: |
673 | * @bcast_sta_id: | ||
674 | * @ht40_channel: is 40MHz width possible in band 2.4 | 680 | * @ht40_channel: is 40MHz width possible in band 2.4 |
675 | * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) | 681 | * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) |
676 | * @sw_crypto: 0 for hw, 1 for sw | 682 | * @sw_crypto: 0 for hw, 1 for sw |
@@ -694,7 +700,6 @@ struct iwl_hw_params { | |||
694 | u32 rx_page_order; | 700 | u32 rx_page_order; |
695 | u32 rx_wrt_ptr_reg; | 701 | u32 rx_wrt_ptr_reg; |
696 | u8 max_stations; | 702 | u8 max_stations; |
697 | u8 bcast_sta_id; | ||
698 | u8 ht40_channel; | 703 | u8 ht40_channel; |
699 | u8 max_beacon_itrvl; /* in 1024 ms */ | 704 | u8 max_beacon_itrvl; /* in 1024 ms */ |
700 | u32 max_inst_size; | 705 | u32 max_inst_size; |
@@ -1064,6 +1069,10 @@ struct iwl_event_log { | |||
1064 | #define IWL_DEF_MONITORING_PERIOD (1000) | 1069 | #define IWL_DEF_MONITORING_PERIOD (1000) |
1065 | #define IWL_LONG_MONITORING_PERIOD (5000) | 1070 | #define IWL_LONG_MONITORING_PERIOD (5000) |
1066 | #define IWL_ONE_HUNDRED_MSECS (100) | 1071 | #define IWL_ONE_HUNDRED_MSECS (100) |
1072 | #define IWL_MAX_MONITORING_PERIOD (60000) | ||
1073 | |||
1074 | /* BT Antenna Coupling Threshold (dB) */ | ||
1075 | #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) | ||
1067 | 1076 | ||
1068 | enum iwl_reset { | 1077 | enum iwl_reset { |
1069 | IWL_RF_RESET = 0, | 1078 | IWL_RF_RESET = 0, |
@@ -1093,6 +1102,57 @@ struct iwl_force_reset { | |||
1093 | */ | 1102 | */ |
1094 | #define IWLAGN_EXT_BEACON_TIME_POS 22 | 1103 | #define IWLAGN_EXT_BEACON_TIME_POS 22 |
1095 | 1104 | ||
1105 | enum iwl_rxon_context_id { | ||
1106 | IWL_RXON_CTX_BSS, | ||
1107 | IWL_RXON_CTX_PAN, | ||
1108 | |||
1109 | NUM_IWL_RXON_CTX | ||
1110 | }; | ||
1111 | |||
1112 | struct iwl_rxon_context { | ||
1113 | struct ieee80211_vif *vif; | ||
1114 | |||
1115 | const u8 *ac_to_fifo; | ||
1116 | const u8 *ac_to_queue; | ||
1117 | u8 mcast_queue; | ||
1118 | |||
1119 | enum iwl_rxon_context_id ctxid; | ||
1120 | |||
1121 | u32 interface_modes, exclusive_interface_modes; | ||
1122 | u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; | ||
1123 | |||
1124 | /* | ||
1125 | * We declare this const so it can only be | ||
1126 | * changed via explicit cast within the | ||
1127 | * routines that actually update the physical | ||
1128 | * hardware. | ||
1129 | */ | ||
1130 | const struct iwl_rxon_cmd active; | ||
1131 | struct iwl_rxon_cmd staging; | ||
1132 | |||
1133 | struct iwl_rxon_time_cmd timing; | ||
1134 | |||
1135 | struct iwl_qos_info qos_data; | ||
1136 | |||
1137 | u8 bcast_sta_id, ap_sta_id; | ||
1138 | |||
1139 | u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd; | ||
1140 | u8 qos_cmd; | ||
1141 | u8 wep_key_cmd; | ||
1142 | |||
1143 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; | ||
1144 | u8 key_mapping_keys; | ||
1145 | |||
1146 | __le32 station_flags; | ||
1147 | |||
1148 | struct { | ||
1149 | bool non_gf_sta_present; | ||
1150 | u8 protection; | ||
1151 | bool enabled, is_40mhz; | ||
1152 | u8 extension_chan_offset; | ||
1153 | } ht; | ||
1154 | }; | ||
1155 | |||
1096 | struct iwl_priv { | 1156 | struct iwl_priv { |
1097 | 1157 | ||
1098 | /* ieee device used by generic ieee processing code */ | 1158 | /* ieee device used by generic ieee processing code */ |
@@ -1169,6 +1229,15 @@ struct iwl_priv { | |||
1169 | u32 hw_wa_rev; | 1229 | u32 hw_wa_rev; |
1170 | u8 rev_id; | 1230 | u8 rev_id; |
1171 | 1231 | ||
1232 | /* microcode/device supports multiple contexts */ | ||
1233 | u8 valid_contexts; | ||
1234 | |||
1235 | /* command queue number */ | ||
1236 | u8 cmd_queue; | ||
1237 | |||
1238 | /* max number of station keys */ | ||
1239 | u8 sta_key_max_num; | ||
1240 | |||
1172 | /* EEPROM MAC addresses */ | 1241 | /* EEPROM MAC addresses */ |
1173 | struct mac_address addresses[2]; | 1242 | struct mac_address addresses[2]; |
1174 | 1243 | ||
@@ -1186,15 +1255,7 @@ struct iwl_priv { | |||
1186 | u8 ucode_write_complete; /* the image write is complete */ | 1255 | u8 ucode_write_complete; /* the image write is complete */ |
1187 | char firmware_name[25]; | 1256 | char firmware_name[25]; |
1188 | 1257 | ||
1189 | 1258 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | |
1190 | struct iwl_rxon_time_cmd rxon_timing; | ||
1191 | |||
1192 | /* We declare this const so it can only be | ||
1193 | * changed via explicit cast within the | ||
1194 | * routines that actually update the physical | ||
1195 | * hardware */ | ||
1196 | const struct iwl_rxon_cmd active_rxon; | ||
1197 | struct iwl_rxon_cmd staging_rxon; | ||
1198 | 1259 | ||
1199 | struct iwl_switch_rxon switch_rxon; | 1260 | struct iwl_switch_rxon switch_rxon; |
1200 | 1261 | ||
@@ -1256,8 +1317,6 @@ struct iwl_priv { | |||
1256 | spinlock_t sta_lock; | 1317 | spinlock_t sta_lock; |
1257 | int num_stations; | 1318 | int num_stations; |
1258 | struct iwl_station_entry stations[IWL_STATION_COUNT]; | 1319 | struct iwl_station_entry stations[IWL_STATION_COUNT]; |
1259 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; /* protected by mutex */ | ||
1260 | u8 key_mapping_key; | ||
1261 | unsigned long ucode_key_table; | 1320 | unsigned long ucode_key_table; |
1262 | 1321 | ||
1263 | /* queue refcounts */ | 1322 | /* queue refcounts */ |
@@ -1282,7 +1341,6 @@ struct iwl_priv { | |||
1282 | 1341 | ||
1283 | /* Last Rx'd beacon timestamp */ | 1342 | /* Last Rx'd beacon timestamp */ |
1284 | u64 timestamp; | 1343 | u64 timestamp; |
1285 | struct ieee80211_vif *vif; | ||
1286 | 1344 | ||
1287 | union { | 1345 | union { |
1288 | #if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE) | 1346 | #if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE) |
@@ -1362,12 +1420,27 @@ struct iwl_priv { | |||
1362 | #endif | 1420 | #endif |
1363 | }; | 1421 | }; |
1364 | 1422 | ||
1423 | /* bt coex */ | ||
1424 | u8 bt_status; | ||
1425 | u8 bt_traffic_load, notif_bt_traffic_load; | ||
1426 | bool bt_ch_announce; | ||
1427 | bool bt_sco_active; | ||
1428 | bool bt_full_concurrent; | ||
1429 | bool bt_ant_couple_ok; | ||
1430 | __le32 kill_ack_mask; | ||
1431 | __le32 kill_cts_mask; | ||
1432 | __le16 bt_valid; | ||
1433 | u16 bt_on_thresh; | ||
1434 | u16 bt_duration; | ||
1435 | u16 dynamic_frag_thresh; | ||
1436 | u16 dynamic_agg_thresh; | ||
1437 | u8 bt_ci_compliance; | ||
1438 | struct work_struct bt_traffic_change_work; | ||
1439 | |||
1365 | struct iwl_hw_params hw_params; | 1440 | struct iwl_hw_params hw_params; |
1366 | 1441 | ||
1367 | u32 inta_mask; | 1442 | u32 inta_mask; |
1368 | 1443 | ||
1369 | struct iwl_qos_info qos_data; | ||
1370 | |||
1371 | struct workqueue_struct *workqueue; | 1444 | struct workqueue_struct *workqueue; |
1372 | 1445 | ||
1373 | struct work_struct restart; | 1446 | struct work_struct restart; |
@@ -1375,11 +1448,15 @@ struct iwl_priv { | |||
1375 | struct work_struct rx_replenish; | 1448 | struct work_struct rx_replenish; |
1376 | struct work_struct abort_scan; | 1449 | struct work_struct abort_scan; |
1377 | struct work_struct beacon_update; | 1450 | struct work_struct beacon_update; |
1451 | struct iwl_rxon_context *beacon_ctx; | ||
1452 | |||
1378 | struct work_struct tt_work; | 1453 | struct work_struct tt_work; |
1379 | struct work_struct ct_enter; | 1454 | struct work_struct ct_enter; |
1380 | struct work_struct ct_exit; | 1455 | struct work_struct ct_exit; |
1381 | struct work_struct start_internal_scan; | 1456 | struct work_struct start_internal_scan; |
1382 | struct work_struct tx_flush; | 1457 | struct work_struct tx_flush; |
1458 | struct work_struct bt_full_concurrency; | ||
1459 | struct work_struct bt_runtime_config; | ||
1383 | 1460 | ||
1384 | struct tasklet_struct irq_tasklet; | 1461 | struct tasklet_struct irq_tasklet; |
1385 | 1462 | ||
@@ -1467,10 +1544,34 @@ static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv, | |||
1467 | return NULL; | 1544 | return NULL; |
1468 | } | 1545 | } |
1469 | 1546 | ||
1547 | static inline struct iwl_rxon_context * | ||
1548 | iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) | ||
1549 | { | ||
1550 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
1551 | |||
1552 | return vif_priv->ctx; | ||
1553 | } | ||
1554 | |||
1555 | #define for_each_context(priv, ctx) \ | ||
1556 | for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ | ||
1557 | ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ | ||
1558 | if (priv->valid_contexts & BIT(ctx->ctxid)) | ||
1559 | |||
1560 | static inline int iwl_is_associated(struct iwl_priv *priv, | ||
1561 | enum iwl_rxon_context_id ctxid) | ||
1562 | { | ||
1563 | return (priv->contexts[ctxid].active.filter_flags & | ||
1564 | RXON_FILTER_ASSOC_MSK) ? 1 : 0; | ||
1565 | } | ||
1566 | |||
1567 | static inline int iwl_is_any_associated(struct iwl_priv *priv) | ||
1568 | { | ||
1569 | return iwl_is_associated(priv, IWL_RXON_CTX_BSS); | ||
1570 | } | ||
1470 | 1571 | ||
1471 | static inline int iwl_is_associated(struct iwl_priv *priv) | 1572 | static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) |
1472 | { | 1573 | { |
1473 | return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; | 1574 | return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; |
1474 | } | 1575 | } |
1475 | 1576 | ||
1476 | static inline int is_channel_valid(const struct iwl_channel_info *ch_info) | 1577 | static inline int is_channel_valid(const struct iwl_channel_info *ch_info) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 258d059ef41f..c373b53babea 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -97,6 +97,17 @@ const char *get_cmd_string(u8 cmd) | |||
97 | IWL_CMD(REPLY_TX_POWER_DBM_CMD); | 97 | IWL_CMD(REPLY_TX_POWER_DBM_CMD); |
98 | IWL_CMD(TEMPERATURE_NOTIFICATION); | 98 | IWL_CMD(TEMPERATURE_NOTIFICATION); |
99 | IWL_CMD(TX_ANT_CONFIGURATION_CMD); | 99 | IWL_CMD(TX_ANT_CONFIGURATION_CMD); |
100 | IWL_CMD(REPLY_BT_COEX_PROFILE_NOTIF); | ||
101 | IWL_CMD(REPLY_BT_COEX_PRIO_TABLE); | ||
102 | IWL_CMD(REPLY_BT_COEX_PROT_ENV); | ||
103 | IWL_CMD(REPLY_WIPAN_PARAMS); | ||
104 | IWL_CMD(REPLY_WIPAN_RXON); | ||
105 | IWL_CMD(REPLY_WIPAN_RXON_TIMING); | ||
106 | IWL_CMD(REPLY_WIPAN_RXON_ASSOC); | ||
107 | IWL_CMD(REPLY_WIPAN_QOS_PARAM); | ||
108 | IWL_CMD(REPLY_WIPAN_WEPKEY); | ||
109 | IWL_CMD(REPLY_WIPAN_P2P_CHANNEL_SWITCH); | ||
110 | IWL_CMD(REPLY_WIPAN_NOA_NOTIFICATION); | ||
100 | default: | 111 | default: |
101 | return "UNKNOWN"; | 112 | return "UNKNOWN"; |
102 | 113 | ||
@@ -229,7 +240,7 @@ cancel: | |||
229 | * in later, it will possibly set an invalid | 240 | * in later, it will possibly set an invalid |
230 | * address (cmd->meta.source). | 241 | * address (cmd->meta.source). |
231 | */ | 242 | */ |
232 | priv->txq[IWL_CMD_QUEUE_NUM].meta[cmd_idx].flags &= | 243 | priv->txq[priv->cmd_queue].meta[cmd_idx].flags &= |
233 | ~CMD_WANT_SKB; | 244 | ~CMD_WANT_SKB; |
234 | } | 245 | } |
235 | fail: | 246 | fail: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index b1f101caf19d..5469655646ae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -306,7 +306,7 @@ | |||
306 | * at a time, until receiving ACK from receiving station, or reaching | 306 | * at a time, until receiving ACK from receiving station, or reaching |
307 | * retry limit and giving up. | 307 | * retry limit and giving up. |
308 | * | 308 | * |
309 | * The command queue (#4) must use this mode! | 309 | * The command queue (#4/#9) must use this mode! |
310 | * This mode does not require use of the Byte Count table in host DRAM. | 310 | * This mode does not require use of the Byte Count table in host DRAM. |
311 | * | 311 | * |
312 | * Driver controls scheduler operation via 3 means: | 312 | * Driver controls scheduler operation via 3 means: |
@@ -322,7 +322,7 @@ | |||
322 | * (1024 bytes for each queue). | 322 | * (1024 bytes for each queue). |
323 | * | 323 | * |
324 | * After receiving "Alive" response from uCode, driver must initialize | 324 | * After receiving "Alive" response from uCode, driver must initialize |
325 | * the scheduler (especially for queue #4, the command queue, otherwise | 325 | * the scheduler (especially for queue #4/#9, the command queue, otherwise |
326 | * the driver can't issue commands!): | 326 | * the driver can't issue commands!): |
327 | */ | 327 | */ |
328 | 328 | ||
@@ -555,8 +555,9 @@ | |||
555 | #define IWLAGN_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ | 555 | #define IWLAGN_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ |
556 | ((IWLAGN_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffc) | 556 | ((IWLAGN_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffc) |
557 | 557 | ||
558 | #define IWLAGN_SCD_QUEUECHAIN_SEL_ALL(x) (((1<<(x)) - 1) &\ | 558 | #define IWLAGN_SCD_QUEUECHAIN_SEL_ALL(priv) \ |
559 | (~(1<<IWL_CMD_QUEUE_NUM))) | 559 | (((1<<(priv)->hw_params.max_txq_num) - 1) &\ |
560 | (~(1<<(priv)->cmd_queue))) | ||
560 | 561 | ||
561 | #define IWLAGN_SCD_BASE (PRPH_BASE + 0xa02c00) | 562 | #define IWLAGN_SCD_BASE (PRPH_BASE + 0xa02c00) |
562 | 563 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 79773e353baa..10be197b0f22 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -228,7 +228,7 @@ void iwl_recover_from_statistics(struct iwl_priv *priv, | |||
228 | { | 228 | { |
229 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 229 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
230 | return; | 230 | return; |
231 | if (iwl_is_associated(priv)) { | 231 | if (iwl_is_any_associated(priv)) { |
232 | if (priv->cfg->ops->lib->check_ack_health) { | 232 | if (priv->cfg->ops->lib->check_ack_health) { |
233 | if (!priv->cfg->ops->lib->check_ack_health( | 233 | if (!priv->cfg->ops->lib->check_ack_health( |
234 | priv, pkt)) { | 234 | priv, pkt)) { |
@@ -266,7 +266,12 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv, | |||
266 | { | 266 | { |
267 | u16 fc = le16_to_cpu(hdr->frame_control); | 267 | u16 fc = le16_to_cpu(hdr->frame_control); |
268 | 268 | ||
269 | if (priv->active_rxon.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) | 269 | /* |
270 | * All contexts have the same setting here due to it being | ||
271 | * a module parameter, so OK to check any context. | ||
272 | */ | ||
273 | if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags & | ||
274 | RXON_FILTER_DIS_DECRYPT_MSK) | ||
270 | return 0; | 275 | return 0; |
271 | 276 | ||
272 | if (!(fc & IEEE80211_FCTL_PROTECTED)) | 277 | if (!(fc & IEEE80211_FCTL_PROTECTED)) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 8d7fa59364fe..7727f0966d31 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -206,7 +206,6 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv, | |||
206 | static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, | 206 | static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, |
207 | struct iwl_rx_mem_buffer *rxb) | 207 | struct iwl_rx_mem_buffer *rxb) |
208 | { | 208 | { |
209 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
210 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 209 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
211 | struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; | 210 | struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; |
212 | 211 | ||
@@ -214,7 +213,6 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, | |||
214 | scan_notif->scanned_channels, | 213 | scan_notif->scanned_channels, |
215 | scan_notif->tsf_low, | 214 | scan_notif->tsf_low, |
216 | scan_notif->tsf_high, scan_notif->status); | 215 | scan_notif->tsf_high, scan_notif->status); |
217 | #endif | ||
218 | 216 | ||
219 | /* The HW is no longer scanning */ | 217 | /* The HW is no longer scanning */ |
220 | clear_bit(STATUS_SCAN_HW, &priv->status); | 218 | clear_bit(STATUS_SCAN_HW, &priv->status); |
@@ -236,6 +234,26 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, | |||
236 | 234 | ||
237 | clear_bit(STATUS_SCANNING, &priv->status); | 235 | clear_bit(STATUS_SCANNING, &priv->status); |
238 | 236 | ||
237 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC && | ||
238 | priv->cfg->advanced_bt_coexist && priv->bt_status != | ||
239 | scan_notif->bt_status) { | ||
240 | if (scan_notif->bt_status) { | ||
241 | /* BT on */ | ||
242 | if (!priv->bt_ch_announce) | ||
243 | priv->bt_traffic_load = | ||
244 | IWL_BT_COEX_TRAFFIC_LOAD_HIGH; | ||
245 | /* | ||
246 | * otherwise, no traffic load information provided | ||
247 | * no changes made | ||
248 | */ | ||
249 | } else { | ||
250 | /* BT off */ | ||
251 | priv->bt_traffic_load = | ||
252 | IWL_BT_COEX_TRAFFIC_LOAD_NONE; | ||
253 | } | ||
254 | priv->bt_status = scan_notif->bt_status; | ||
255 | queue_work(priv->workqueue, &priv->bt_traffic_change_work); | ||
256 | } | ||
239 | queue_work(priv->workqueue, &priv->scan_completed); | 257 | queue_work(priv->workqueue, &priv->scan_completed); |
240 | } | 258 | } |
241 | 259 | ||
@@ -268,18 +286,28 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | |||
268 | enum ieee80211_band band, | 286 | enum ieee80211_band band, |
269 | struct ieee80211_vif *vif) | 287 | struct ieee80211_vif *vif) |
270 | { | 288 | { |
289 | struct iwl_rxon_context *ctx; | ||
271 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? | 290 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? |
272 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 291 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
273 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | 292 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; |
274 | 293 | ||
275 | if (iwl_is_associated(priv)) { | 294 | if (iwl_is_any_associated(priv)) { |
276 | /* If we're associated, we clamp the maximum passive | 295 | /* |
277 | * dwell time to be 98% of the beacon interval (minus | 296 | * If we're associated, we clamp the maximum passive |
278 | * 2 * channel tune time) */ | 297 | * dwell time to be 98% of the smallest beacon interval |
279 | passive = vif ? vif->bss_conf.beacon_int : 0; | 298 | * (minus 2 * channel tune time) |
280 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) | 299 | */ |
281 | passive = IWL_PASSIVE_DWELL_BASE; | 300 | for_each_context(priv, ctx) { |
282 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | 301 | u16 value; |
302 | |||
303 | if (!iwl_is_associated_ctx(ctx)) | ||
304 | continue; | ||
305 | value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0; | ||
306 | if ((value > IWL_PASSIVE_DWELL_BASE) || !value) | ||
307 | value = IWL_PASSIVE_DWELL_BASE; | ||
308 | value = (value * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | ||
309 | passive = min(value, passive); | ||
310 | } | ||
283 | } | 311 | } |
284 | 312 | ||
285 | return passive; | 313 | return passive; |
@@ -509,6 +537,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) | |||
509 | container_of(work, struct iwl_priv, scan_completed); | 537 | container_of(work, struct iwl_priv, scan_completed); |
510 | bool internal = false; | 538 | bool internal = false; |
511 | bool scan_completed = false; | 539 | bool scan_completed = false; |
540 | struct iwl_rxon_context *ctx; | ||
512 | 541 | ||
513 | IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); | 542 | IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); |
514 | 543 | ||
@@ -539,11 +568,13 @@ static void iwl_bg_scan_completed(struct work_struct *work) | |||
539 | * Since setting the RXON may have been deferred while | 568 | * Since setting the RXON may have been deferred while |
540 | * performing the scan, fire one off if needed | 569 | * performing the scan, fire one off if needed |
541 | */ | 570 | */ |
542 | if (memcmp(&priv->active_rxon, | 571 | for_each_context(priv, ctx) |
543 | &priv->staging_rxon, sizeof(priv->staging_rxon))) | 572 | iwlcore_commit_rxon(priv, ctx); |
544 | iwlcore_commit_rxon(priv); | ||
545 | 573 | ||
546 | out: | 574 | out: |
575 | if (priv->cfg->ops->hcmd->set_pan_params) | ||
576 | priv->cfg->ops->hcmd->set_pan_params(priv); | ||
577 | |||
547 | mutex_unlock(&priv->mutex); | 578 | mutex_unlock(&priv->mutex); |
548 | 579 | ||
549 | /* | 580 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index d5e8db37b86e..ccd09027c7cd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -172,12 +172,14 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
172 | EXPORT_SYMBOL(iwl_send_add_sta); | 172 | EXPORT_SYMBOL(iwl_send_add_sta); |
173 | 173 | ||
174 | static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | 174 | static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, |
175 | struct ieee80211_sta_ht_cap *sta_ht_inf) | 175 | struct ieee80211_sta *sta, |
176 | struct iwl_rxon_context *ctx) | ||
176 | { | 177 | { |
178 | struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; | ||
177 | __le32 sta_flags; | 179 | __le32 sta_flags; |
178 | u8 mimo_ps_mode; | 180 | u8 mimo_ps_mode; |
179 | 181 | ||
180 | if (!sta_ht_inf || !sta_ht_inf->ht_supported) | 182 | if (!sta || !sta_ht_inf->ht_supported) |
181 | goto done; | 183 | goto done; |
182 | 184 | ||
183 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; | 185 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; |
@@ -211,7 +213,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | |||
211 | sta_flags |= cpu_to_le32( | 213 | sta_flags |= cpu_to_le32( |
212 | (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); | 214 | (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); |
213 | 215 | ||
214 | if (iwl_is_ht40_tx_allowed(priv, sta_ht_inf)) | 216 | if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) |
215 | sta_flags |= STA_FLG_HT40_EN_MSK; | 217 | sta_flags |= STA_FLG_HT40_EN_MSK; |
216 | else | 218 | else |
217 | sta_flags &= ~STA_FLG_HT40_EN_MSK; | 219 | sta_flags &= ~STA_FLG_HT40_EN_MSK; |
@@ -226,9 +228,9 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, | |||
226 | * | 228 | * |
227 | * should be called with sta_lock held | 229 | * should be called with sta_lock held |
228 | */ | 230 | */ |
229 | static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr, | 231 | static u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
230 | bool is_ap, | 232 | const u8 *addr, bool is_ap, |
231 | struct ieee80211_sta_ht_cap *ht_info) | 233 | struct ieee80211_sta *sta) |
232 | { | 234 | { |
233 | struct iwl_station_entry *station; | 235 | struct iwl_station_entry *station; |
234 | int i; | 236 | int i; |
@@ -236,9 +238,9 @@ static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr, | |||
236 | u16 rate; | 238 | u16 rate; |
237 | 239 | ||
238 | if (is_ap) | 240 | if (is_ap) |
239 | sta_id = IWL_AP_ID; | 241 | sta_id = ctx->ap_sta_id; |
240 | else if (is_broadcast_ether_addr(addr)) | 242 | else if (is_broadcast_ether_addr(addr)) |
241 | sta_id = priv->hw_params.bcast_sta_id; | 243 | sta_id = ctx->bcast_sta_id; |
242 | else | 244 | else |
243 | for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) { | 245 | for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) { |
244 | if (!compare_ether_addr(priv->stations[i].sta.sta.addr, | 246 | if (!compare_ether_addr(priv->stations[i].sta.sta.addr, |
@@ -289,14 +291,22 @@ static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr, | |||
289 | memcpy(station->sta.sta.addr, addr, ETH_ALEN); | 291 | memcpy(station->sta.sta.addr, addr, ETH_ALEN); |
290 | station->sta.mode = 0; | 292 | station->sta.mode = 0; |
291 | station->sta.sta.sta_id = sta_id; | 293 | station->sta.sta.sta_id = sta_id; |
292 | station->sta.station_flags = 0; | 294 | station->sta.station_flags = ctx->station_flags; |
295 | station->ctxid = ctx->ctxid; | ||
296 | |||
297 | if (sta) { | ||
298 | struct iwl_station_priv_common *sta_priv; | ||
299 | |||
300 | sta_priv = (void *)sta->drv_priv; | ||
301 | sta_priv->ctx = ctx; | ||
302 | } | ||
293 | 303 | ||
294 | /* | 304 | /* |
295 | * OK to call unconditionally, since local stations (IBSS BSSID | 305 | * OK to call unconditionally, since local stations (IBSS BSSID |
296 | * STA and broadcast STA) pass in a NULL ht_info, and mac80211 | 306 | * STA and broadcast STA) pass in a NULL sta, and mac80211 |
297 | * doesn't allow HT IBSS. | 307 | * doesn't allow HT IBSS. |
298 | */ | 308 | */ |
299 | iwl_set_ht_add_station(priv, sta_id, ht_info); | 309 | iwl_set_ht_add_station(priv, sta_id, sta, ctx); |
300 | 310 | ||
301 | /* 3945 only */ | 311 | /* 3945 only */ |
302 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? | 312 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? |
@@ -313,10 +323,9 @@ static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr, | |||
313 | /** | 323 | /** |
314 | * iwl_add_station_common - | 324 | * iwl_add_station_common - |
315 | */ | 325 | */ |
316 | int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | 326 | int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
317 | bool is_ap, | 327 | const u8 *addr, bool is_ap, |
318 | struct ieee80211_sta_ht_cap *ht_info, | 328 | struct ieee80211_sta *sta, u8 *sta_id_r) |
319 | u8 *sta_id_r) | ||
320 | { | 329 | { |
321 | unsigned long flags_spin; | 330 | unsigned long flags_spin; |
322 | int ret = 0; | 331 | int ret = 0; |
@@ -325,7 +334,7 @@ int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | |||
325 | 334 | ||
326 | *sta_id_r = 0; | 335 | *sta_id_r = 0; |
327 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 336 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
328 | sta_id = iwl_prep_station(priv, addr, is_ap, ht_info); | 337 | sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta); |
329 | if (sta_id == IWL_INVALID_STATION) { | 338 | if (sta_id == IWL_INVALID_STATION) { |
330 | IWL_ERR(priv, "Unable to prepare station %pM for addition\n", | 339 | IWL_ERR(priv, "Unable to prepare station %pM for addition\n", |
331 | addr); | 340 | addr); |
@@ -431,8 +440,8 @@ static struct iwl_link_quality_cmd *iwl_sta_alloc_lq(struct iwl_priv *priv, | |||
431 | * | 440 | * |
432 | * Function sleeps. | 441 | * Function sleeps. |
433 | */ | 442 | */ |
434 | int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, | 443 | int iwl_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
435 | u8 *sta_id_r) | 444 | const u8 *addr, bool init_rs, u8 *sta_id_r) |
436 | { | 445 | { |
437 | int ret; | 446 | int ret; |
438 | u8 sta_id; | 447 | u8 sta_id; |
@@ -442,7 +451,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, | |||
442 | if (sta_id_r) | 451 | if (sta_id_r) |
443 | *sta_id_r = IWL_INVALID_STATION; | 452 | *sta_id_r = IWL_INVALID_STATION; |
444 | 453 | ||
445 | ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id); | 454 | ret = iwl_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); |
446 | if (ret) { | 455 | if (ret) { |
447 | IWL_ERR(priv, "Unable to add station %pM\n", addr); | 456 | IWL_ERR(priv, "Unable to add station %pM\n", addr); |
448 | return ret; | 457 | return ret; |
@@ -464,7 +473,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, | |||
464 | return -ENOMEM; | 473 | return -ENOMEM; |
465 | } | 474 | } |
466 | 475 | ||
467 | ret = iwl_send_lq_cmd(priv, link_cmd, CMD_SYNC, true); | 476 | ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); |
468 | if (ret) | 477 | if (ret) |
469 | IWL_ERR(priv, "Link quality command failed (%d)\n", ret); | 478 | IWL_ERR(priv, "Link quality command failed (%d)\n", ret); |
470 | 479 | ||
@@ -616,7 +625,8 @@ EXPORT_SYMBOL_GPL(iwl_remove_station); | |||
616 | * other than explicit station management would cause this in | 625 | * other than explicit station management would cause this in |
617 | * the ucode, e.g. unassociated RXON. | 626 | * the ucode, e.g. unassociated RXON. |
618 | */ | 627 | */ |
619 | void iwl_clear_ucode_stations(struct iwl_priv *priv) | 628 | void iwl_clear_ucode_stations(struct iwl_priv *priv, |
629 | struct iwl_rxon_context *ctx) | ||
620 | { | 630 | { |
621 | int i; | 631 | int i; |
622 | unsigned long flags_spin; | 632 | unsigned long flags_spin; |
@@ -626,6 +636,9 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv) | |||
626 | 636 | ||
627 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 637 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
628 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 638 | for (i = 0; i < priv->hw_params.max_stations; i++) { |
639 | if (ctx && ctx->ctxid != priv->stations[i].ctxid) | ||
640 | continue; | ||
641 | |||
629 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { | 642 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { |
630 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); | 643 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); |
631 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; | 644 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; |
@@ -647,7 +660,7 @@ EXPORT_SYMBOL(iwl_clear_ucode_stations); | |||
647 | * | 660 | * |
648 | * Function sleeps. | 661 | * Function sleeps. |
649 | */ | 662 | */ |
650 | void iwl_restore_stations(struct iwl_priv *priv) | 663 | void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) |
651 | { | 664 | { |
652 | struct iwl_addsta_cmd sta_cmd; | 665 | struct iwl_addsta_cmd sta_cmd; |
653 | struct iwl_link_quality_cmd lq; | 666 | struct iwl_link_quality_cmd lq; |
@@ -665,6 +678,8 @@ void iwl_restore_stations(struct iwl_priv *priv) | |||
665 | IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); | 678 | IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); |
666 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 679 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
667 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 680 | for (i = 0; i < priv->hw_params.max_stations; i++) { |
681 | if (ctx->ctxid != priv->stations[i].ctxid) | ||
682 | continue; | ||
668 | if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && | 683 | if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && |
669 | !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { | 684 | !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { |
670 | IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", | 685 | IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", |
@@ -700,7 +715,7 @@ void iwl_restore_stations(struct iwl_priv *priv) | |||
700 | * current LQ command | 715 | * current LQ command |
701 | */ | 716 | */ |
702 | if (send_lq) | 717 | if (send_lq) |
703 | iwl_send_lq_cmd(priv, &lq, CMD_SYNC, true); | 718 | iwl_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true); |
704 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 719 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
705 | priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; | 720 | priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; |
706 | } | 721 | } |
@@ -718,7 +733,7 @@ int iwl_get_free_ucode_key_index(struct iwl_priv *priv) | |||
718 | { | 733 | { |
719 | int i; | 734 | int i; |
720 | 735 | ||
721 | for (i = 0; i < STA_KEY_MAX_NUM; i++) | 736 | for (i = 0; i < priv->sta_key_max_num; i++) |
722 | if (!test_and_set_bit(i, &priv->ucode_key_table)) | 737 | if (!test_and_set_bit(i, &priv->ucode_key_table)) |
723 | return i; | 738 | return i; |
724 | 739 | ||
@@ -726,7 +741,9 @@ int iwl_get_free_ucode_key_index(struct iwl_priv *priv) | |||
726 | } | 741 | } |
727 | EXPORT_SYMBOL(iwl_get_free_ucode_key_index); | 742 | EXPORT_SYMBOL(iwl_get_free_ucode_key_index); |
728 | 743 | ||
729 | static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | 744 | static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, |
745 | struct iwl_rxon_context *ctx, | ||
746 | bool send_if_empty) | ||
730 | { | 747 | { |
731 | int i, not_empty = 0; | 748 | int i, not_empty = 0; |
732 | u8 buff[sizeof(struct iwl_wep_cmd) + | 749 | u8 buff[sizeof(struct iwl_wep_cmd) + |
@@ -734,7 +751,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | |||
734 | struct iwl_wep_cmd *wep_cmd = (struct iwl_wep_cmd *)buff; | 751 | struct iwl_wep_cmd *wep_cmd = (struct iwl_wep_cmd *)buff; |
735 | size_t cmd_size = sizeof(struct iwl_wep_cmd); | 752 | size_t cmd_size = sizeof(struct iwl_wep_cmd); |
736 | struct iwl_host_cmd cmd = { | 753 | struct iwl_host_cmd cmd = { |
737 | .id = REPLY_WEPKEY, | 754 | .id = ctx->wep_key_cmd, |
738 | .data = wep_cmd, | 755 | .data = wep_cmd, |
739 | .flags = CMD_SYNC, | 756 | .flags = CMD_SYNC, |
740 | }; | 757 | }; |
@@ -746,16 +763,16 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | |||
746 | 763 | ||
747 | for (i = 0; i < WEP_KEYS_MAX ; i++) { | 764 | for (i = 0; i < WEP_KEYS_MAX ; i++) { |
748 | wep_cmd->key[i].key_index = i; | 765 | wep_cmd->key[i].key_index = i; |
749 | if (priv->wep_keys[i].key_size) { | 766 | if (ctx->wep_keys[i].key_size) { |
750 | wep_cmd->key[i].key_offset = i; | 767 | wep_cmd->key[i].key_offset = i; |
751 | not_empty = 1; | 768 | not_empty = 1; |
752 | } else { | 769 | } else { |
753 | wep_cmd->key[i].key_offset = WEP_INVALID_OFFSET; | 770 | wep_cmd->key[i].key_offset = WEP_INVALID_OFFSET; |
754 | } | 771 | } |
755 | 772 | ||
756 | wep_cmd->key[i].key_size = priv->wep_keys[i].key_size; | 773 | wep_cmd->key[i].key_size = ctx->wep_keys[i].key_size; |
757 | memcpy(&wep_cmd->key[i].key[3], priv->wep_keys[i].key, | 774 | memcpy(&wep_cmd->key[i].key[3], ctx->wep_keys[i].key, |
758 | priv->wep_keys[i].key_size); | 775 | ctx->wep_keys[i].key_size); |
759 | } | 776 | } |
760 | 777 | ||
761 | wep_cmd->global_key_type = WEP_KEY_WEP_TYPE; | 778 | wep_cmd->global_key_type = WEP_KEY_WEP_TYPE; |
@@ -771,15 +788,17 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | |||
771 | return 0; | 788 | return 0; |
772 | } | 789 | } |
773 | 790 | ||
774 | int iwl_restore_default_wep_keys(struct iwl_priv *priv) | 791 | int iwl_restore_default_wep_keys(struct iwl_priv *priv, |
792 | struct iwl_rxon_context *ctx) | ||
775 | { | 793 | { |
776 | lockdep_assert_held(&priv->mutex); | 794 | lockdep_assert_held(&priv->mutex); |
777 | 795 | ||
778 | return iwl_send_static_wepkey_cmd(priv, 0); | 796 | return iwl_send_static_wepkey_cmd(priv, ctx, false); |
779 | } | 797 | } |
780 | EXPORT_SYMBOL(iwl_restore_default_wep_keys); | 798 | EXPORT_SYMBOL(iwl_restore_default_wep_keys); |
781 | 799 | ||
782 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 800 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
801 | struct iwl_rxon_context *ctx, | ||
783 | struct ieee80211_key_conf *keyconf) | 802 | struct ieee80211_key_conf *keyconf) |
784 | { | 803 | { |
785 | int ret; | 804 | int ret; |
@@ -789,13 +808,13 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
789 | IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", | 808 | IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", |
790 | keyconf->keyidx); | 809 | keyconf->keyidx); |
791 | 810 | ||
792 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); | 811 | memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); |
793 | if (iwl_is_rfkill(priv)) { | 812 | if (iwl_is_rfkill(priv)) { |
794 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); | 813 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); |
795 | /* but keys in device are clear anyway so return success */ | 814 | /* but keys in device are clear anyway so return success */ |
796 | return 0; | 815 | return 0; |
797 | } | 816 | } |
798 | ret = iwl_send_static_wepkey_cmd(priv, 1); | 817 | ret = iwl_send_static_wepkey_cmd(priv, ctx, 1); |
799 | IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", | 818 | IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", |
800 | keyconf->keyidx, ret); | 819 | keyconf->keyidx, ret); |
801 | 820 | ||
@@ -804,6 +823,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
804 | EXPORT_SYMBOL(iwl_remove_default_wep_key); | 823 | EXPORT_SYMBOL(iwl_remove_default_wep_key); |
805 | 824 | ||
806 | int iwl_set_default_wep_key(struct iwl_priv *priv, | 825 | int iwl_set_default_wep_key(struct iwl_priv *priv, |
826 | struct iwl_rxon_context *ctx, | ||
807 | struct ieee80211_key_conf *keyconf) | 827 | struct ieee80211_key_conf *keyconf) |
808 | { | 828 | { |
809 | int ret; | 829 | int ret; |
@@ -818,13 +838,13 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, | |||
818 | 838 | ||
819 | keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; | 839 | keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; |
820 | keyconf->hw_key_idx = HW_KEY_DEFAULT; | 840 | keyconf->hw_key_idx = HW_KEY_DEFAULT; |
821 | priv->stations[IWL_AP_ID].keyinfo.cipher = keyconf->cipher; | 841 | priv->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher; |
822 | 842 | ||
823 | priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; | 843 | ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; |
824 | memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key, | 844 | memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key, |
825 | keyconf->keylen); | 845 | keyconf->keylen); |
826 | 846 | ||
827 | ret = iwl_send_static_wepkey_cmd(priv, 0); | 847 | ret = iwl_send_static_wepkey_cmd(priv, ctx, false); |
828 | IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", | 848 | IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", |
829 | keyconf->keylen, keyconf->keyidx, ret); | 849 | keyconf->keylen, keyconf->keyidx, ret); |
830 | 850 | ||
@@ -833,8 +853,9 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, | |||
833 | EXPORT_SYMBOL(iwl_set_default_wep_key); | 853 | EXPORT_SYMBOL(iwl_set_default_wep_key); |
834 | 854 | ||
835 | static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv, | 855 | static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv, |
836 | struct ieee80211_key_conf *keyconf, | 856 | struct iwl_rxon_context *ctx, |
837 | u8 sta_id) | 857 | struct ieee80211_key_conf *keyconf, |
858 | u8 sta_id) | ||
838 | { | 859 | { |
839 | unsigned long flags; | 860 | unsigned long flags; |
840 | __le16 key_flags = 0; | 861 | __le16 key_flags = 0; |
@@ -851,7 +872,7 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv, | |||
851 | if (keyconf->keylen == WEP_KEY_LEN_128) | 872 | if (keyconf->keylen == WEP_KEY_LEN_128) |
852 | key_flags |= STA_KEY_FLG_KEY_SIZE_MSK; | 873 | key_flags |= STA_KEY_FLG_KEY_SIZE_MSK; |
853 | 874 | ||
854 | if (sta_id == priv->hw_params.bcast_sta_id) | 875 | if (sta_id == ctx->bcast_sta_id) |
855 | key_flags |= STA_KEY_MULTICAST_MSK; | 876 | key_flags |= STA_KEY_MULTICAST_MSK; |
856 | 877 | ||
857 | spin_lock_irqsave(&priv->sta_lock, flags); | 878 | spin_lock_irqsave(&priv->sta_lock, flags); |
@@ -887,8 +908,9 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv, | |||
887 | } | 908 | } |
888 | 909 | ||
889 | static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv, | 910 | static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv, |
890 | struct ieee80211_key_conf *keyconf, | 911 | struct iwl_rxon_context *ctx, |
891 | u8 sta_id) | 912 | struct ieee80211_key_conf *keyconf, |
913 | u8 sta_id) | ||
892 | { | 914 | { |
893 | unsigned long flags; | 915 | unsigned long flags; |
894 | __le16 key_flags = 0; | 916 | __le16 key_flags = 0; |
@@ -900,7 +922,7 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv, | |||
900 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 922 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
901 | key_flags &= ~STA_KEY_FLG_INVALID; | 923 | key_flags &= ~STA_KEY_FLG_INVALID; |
902 | 924 | ||
903 | if (sta_id == priv->hw_params.bcast_sta_id) | 925 | if (sta_id == ctx->bcast_sta_id) |
904 | key_flags |= STA_KEY_MULTICAST_MSK; | 926 | key_flags |= STA_KEY_MULTICAST_MSK; |
905 | 927 | ||
906 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 928 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
@@ -936,8 +958,9 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv, | |||
936 | } | 958 | } |
937 | 959 | ||
938 | static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, | 960 | static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, |
939 | struct ieee80211_key_conf *keyconf, | 961 | struct iwl_rxon_context *ctx, |
940 | u8 sta_id) | 962 | struct ieee80211_key_conf *keyconf, |
963 | u8 sta_id) | ||
941 | { | 964 | { |
942 | unsigned long flags; | 965 | unsigned long flags; |
943 | int ret = 0; | 966 | int ret = 0; |
@@ -947,7 +970,7 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, | |||
947 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 970 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
948 | key_flags &= ~STA_KEY_FLG_INVALID; | 971 | key_flags &= ~STA_KEY_FLG_INVALID; |
949 | 972 | ||
950 | if (sta_id == priv->hw_params.bcast_sta_id) | 973 | if (sta_id == ctx->bcast_sta_id) |
951 | key_flags |= STA_KEY_MULTICAST_MSK; | 974 | key_flags |= STA_KEY_MULTICAST_MSK; |
952 | 975 | ||
953 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 976 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
@@ -982,8 +1005,9 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, | |||
982 | } | 1005 | } |
983 | 1006 | ||
984 | void iwl_update_tkip_key(struct iwl_priv *priv, | 1007 | void iwl_update_tkip_key(struct iwl_priv *priv, |
985 | struct ieee80211_key_conf *keyconf, | 1008 | struct iwl_rxon_context *ctx, |
986 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) | 1009 | struct ieee80211_key_conf *keyconf, |
1010 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) | ||
987 | { | 1011 | { |
988 | u8 sta_id; | 1012 | u8 sta_id; |
989 | unsigned long flags; | 1013 | unsigned long flags; |
@@ -995,7 +1019,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv, | |||
995 | return; | 1019 | return; |
996 | } | 1020 | } |
997 | 1021 | ||
998 | sta_id = iwl_sta_id_or_broadcast(priv, sta); | 1022 | sta_id = iwl_sta_id_or_broadcast(priv, ctx, sta); |
999 | if (sta_id == IWL_INVALID_STATION) | 1023 | if (sta_id == IWL_INVALID_STATION) |
1000 | return; | 1024 | return; |
1001 | 1025 | ||
@@ -1018,8 +1042,9 @@ void iwl_update_tkip_key(struct iwl_priv *priv, | |||
1018 | EXPORT_SYMBOL(iwl_update_tkip_key); | 1042 | EXPORT_SYMBOL(iwl_update_tkip_key); |
1019 | 1043 | ||
1020 | int iwl_remove_dynamic_key(struct iwl_priv *priv, | 1044 | int iwl_remove_dynamic_key(struct iwl_priv *priv, |
1021 | struct ieee80211_key_conf *keyconf, | 1045 | struct iwl_rxon_context *ctx, |
1022 | u8 sta_id) | 1046 | struct ieee80211_key_conf *keyconf, |
1047 | u8 sta_id) | ||
1023 | { | 1048 | { |
1024 | unsigned long flags; | 1049 | unsigned long flags; |
1025 | u16 key_flags; | 1050 | u16 key_flags; |
@@ -1028,7 +1053,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
1028 | 1053 | ||
1029 | lockdep_assert_held(&priv->mutex); | 1054 | lockdep_assert_held(&priv->mutex); |
1030 | 1055 | ||
1031 | priv->key_mapping_key--; | 1056 | ctx->key_mapping_keys--; |
1032 | 1057 | ||
1033 | spin_lock_irqsave(&priv->sta_lock, flags); | 1058 | spin_lock_irqsave(&priv->sta_lock, flags); |
1034 | key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags); | 1059 | key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags); |
@@ -1080,26 +1105,26 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
1080 | } | 1105 | } |
1081 | EXPORT_SYMBOL(iwl_remove_dynamic_key); | 1106 | EXPORT_SYMBOL(iwl_remove_dynamic_key); |
1082 | 1107 | ||
1083 | int iwl_set_dynamic_key(struct iwl_priv *priv, | 1108 | int iwl_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
1084 | struct ieee80211_key_conf *keyconf, u8 sta_id) | 1109 | struct ieee80211_key_conf *keyconf, u8 sta_id) |
1085 | { | 1110 | { |
1086 | int ret; | 1111 | int ret; |
1087 | 1112 | ||
1088 | lockdep_assert_held(&priv->mutex); | 1113 | lockdep_assert_held(&priv->mutex); |
1089 | 1114 | ||
1090 | priv->key_mapping_key++; | 1115 | ctx->key_mapping_keys++; |
1091 | keyconf->hw_key_idx = HW_KEY_DYNAMIC; | 1116 | keyconf->hw_key_idx = HW_KEY_DYNAMIC; |
1092 | 1117 | ||
1093 | switch (keyconf->cipher) { | 1118 | switch (keyconf->cipher) { |
1094 | case WLAN_CIPHER_SUITE_CCMP: | 1119 | case WLAN_CIPHER_SUITE_CCMP: |
1095 | ret = iwl_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); | 1120 | ret = iwl_set_ccmp_dynamic_key_info(priv, ctx, keyconf, sta_id); |
1096 | break; | 1121 | break; |
1097 | case WLAN_CIPHER_SUITE_TKIP: | 1122 | case WLAN_CIPHER_SUITE_TKIP: |
1098 | ret = iwl_set_tkip_dynamic_key_info(priv, keyconf, sta_id); | 1123 | ret = iwl_set_tkip_dynamic_key_info(priv, ctx, keyconf, sta_id); |
1099 | break; | 1124 | break; |
1100 | case WLAN_CIPHER_SUITE_WEP40: | 1125 | case WLAN_CIPHER_SUITE_WEP40: |
1101 | case WLAN_CIPHER_SUITE_WEP104: | 1126 | case WLAN_CIPHER_SUITE_WEP104: |
1102 | ret = iwl_set_wep_dynamic_key_info(priv, keyconf, sta_id); | 1127 | ret = iwl_set_wep_dynamic_key_info(priv, ctx, keyconf, sta_id); |
1103 | break; | 1128 | break; |
1104 | default: | 1129 | default: |
1105 | IWL_ERR(priv, | 1130 | IWL_ERR(priv, |
@@ -1149,16 +1174,16 @@ static inline void iwl_dump_lq_cmd(struct iwl_priv *priv, | |||
1149 | * RXON flags are updated and when LQ command is updated. | 1174 | * RXON flags are updated and when LQ command is updated. |
1150 | */ | 1175 | */ |
1151 | static bool is_lq_table_valid(struct iwl_priv *priv, | 1176 | static bool is_lq_table_valid(struct iwl_priv *priv, |
1177 | struct iwl_rxon_context *ctx, | ||
1152 | struct iwl_link_quality_cmd *lq) | 1178 | struct iwl_link_quality_cmd *lq) |
1153 | { | 1179 | { |
1154 | int i; | 1180 | int i; |
1155 | struct iwl_ht_config *ht_conf = &priv->current_ht_config; | ||
1156 | 1181 | ||
1157 | if (ht_conf->is_ht) | 1182 | if (ctx->ht.enabled) |
1158 | return true; | 1183 | return true; |
1159 | 1184 | ||
1160 | IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", | 1185 | IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", |
1161 | priv->active_rxon.channel); | 1186 | ctx->active.channel); |
1162 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { | 1187 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { |
1163 | if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { | 1188 | if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { |
1164 | IWL_DEBUG_INFO(priv, | 1189 | IWL_DEBUG_INFO(priv, |
@@ -1180,7 +1205,7 @@ static bool is_lq_table_valid(struct iwl_priv *priv, | |||
1180 | * this case to clear the state indicating that station creation is in | 1205 | * this case to clear the state indicating that station creation is in |
1181 | * progress. | 1206 | * progress. |
1182 | */ | 1207 | */ |
1183 | int iwl_send_lq_cmd(struct iwl_priv *priv, | 1208 | int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
1184 | struct iwl_link_quality_cmd *lq, u8 flags, bool init) | 1209 | struct iwl_link_quality_cmd *lq, u8 flags, bool init) |
1185 | { | 1210 | { |
1186 | int ret = 0; | 1211 | int ret = 0; |
@@ -1199,7 +1224,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1199 | iwl_dump_lq_cmd(priv, lq); | 1224 | iwl_dump_lq_cmd(priv, lq); |
1200 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); | 1225 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); |
1201 | 1226 | ||
1202 | if (is_lq_table_valid(priv, lq)) | 1227 | if (is_lq_table_valid(priv, ctx, lq)) |
1203 | ret = iwl_send_cmd(priv, &cmd); | 1228 | ret = iwl_send_cmd(priv, &cmd); |
1204 | else | 1229 | else |
1205 | ret = -EINVAL; | 1230 | ret = -EINVAL; |
@@ -1225,14 +1250,15 @@ EXPORT_SYMBOL(iwl_send_lq_cmd); | |||
1225 | * and marks it driver active, so that it will be restored to the | 1250 | * and marks it driver active, so that it will be restored to the |
1226 | * device at the next best time. | 1251 | * device at the next best time. |
1227 | */ | 1252 | */ |
1228 | int iwl_alloc_bcast_station(struct iwl_priv *priv, bool init_lq) | 1253 | int iwl_alloc_bcast_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
1254 | bool init_lq) | ||
1229 | { | 1255 | { |
1230 | struct iwl_link_quality_cmd *link_cmd; | 1256 | struct iwl_link_quality_cmd *link_cmd; |
1231 | unsigned long flags; | 1257 | unsigned long flags; |
1232 | u8 sta_id; | 1258 | u8 sta_id; |
1233 | 1259 | ||
1234 | spin_lock_irqsave(&priv->sta_lock, flags); | 1260 | spin_lock_irqsave(&priv->sta_lock, flags); |
1235 | sta_id = iwl_prep_station(priv, iwl_bcast_addr, false, NULL); | 1261 | sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL); |
1236 | if (sta_id == IWL_INVALID_STATION) { | 1262 | if (sta_id == IWL_INVALID_STATION) { |
1237 | IWL_ERR(priv, "Unable to prepare broadcast station\n"); | 1263 | IWL_ERR(priv, "Unable to prepare broadcast station\n"); |
1238 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1264 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
@@ -1267,11 +1293,12 @@ EXPORT_SYMBOL_GPL(iwl_alloc_bcast_station); | |||
1267 | * Only used by iwlagn. Placed here to have all bcast station management | 1293 | * Only used by iwlagn. Placed here to have all bcast station management |
1268 | * code together. | 1294 | * code together. |
1269 | */ | 1295 | */ |
1270 | int iwl_update_bcast_station(struct iwl_priv *priv) | 1296 | static int iwl_update_bcast_station(struct iwl_priv *priv, |
1297 | struct iwl_rxon_context *ctx) | ||
1271 | { | 1298 | { |
1272 | unsigned long flags; | 1299 | unsigned long flags; |
1273 | struct iwl_link_quality_cmd *link_cmd; | 1300 | struct iwl_link_quality_cmd *link_cmd; |
1274 | u8 sta_id = priv->hw_params.bcast_sta_id; | 1301 | u8 sta_id = ctx->bcast_sta_id; |
1275 | 1302 | ||
1276 | link_cmd = iwl_sta_alloc_lq(priv, sta_id); | 1303 | link_cmd = iwl_sta_alloc_lq(priv, sta_id); |
1277 | if (!link_cmd) { | 1304 | if (!link_cmd) { |
@@ -1289,9 +1316,23 @@ int iwl_update_bcast_station(struct iwl_priv *priv) | |||
1289 | 1316 | ||
1290 | return 0; | 1317 | return 0; |
1291 | } | 1318 | } |
1292 | EXPORT_SYMBOL_GPL(iwl_update_bcast_station); | ||
1293 | 1319 | ||
1294 | void iwl_dealloc_bcast_station(struct iwl_priv *priv) | 1320 | int iwl_update_bcast_stations(struct iwl_priv *priv) |
1321 | { | ||
1322 | struct iwl_rxon_context *ctx; | ||
1323 | int ret = 0; | ||
1324 | |||
1325 | for_each_context(priv, ctx) { | ||
1326 | ret = iwl_update_bcast_station(priv, ctx); | ||
1327 | if (ret) | ||
1328 | break; | ||
1329 | } | ||
1330 | |||
1331 | return ret; | ||
1332 | } | ||
1333 | EXPORT_SYMBOL_GPL(iwl_update_bcast_stations); | ||
1334 | |||
1335 | void iwl_dealloc_bcast_stations(struct iwl_priv *priv) | ||
1295 | { | 1336 | { |
1296 | unsigned long flags; | 1337 | unsigned long flags; |
1297 | int i; | 1338 | int i; |
@@ -1309,7 +1350,7 @@ void iwl_dealloc_bcast_station(struct iwl_priv *priv) | |||
1309 | } | 1350 | } |
1310 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1351 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1311 | } | 1352 | } |
1312 | EXPORT_SYMBOL_GPL(iwl_dealloc_bcast_station); | 1353 | EXPORT_SYMBOL_GPL(iwl_dealloc_bcast_stations); |
1313 | 1354 | ||
1314 | /** | 1355 | /** |
1315 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table | 1356 | * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h index d38a350ba0bd..56bad3f60d81 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.h +++ b/drivers/net/wireless/iwlwifi/iwl-sta.h | |||
@@ -44,32 +44,37 @@ | |||
44 | 44 | ||
45 | 45 | ||
46 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 46 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
47 | struct iwl_rxon_context *ctx, | ||
47 | struct ieee80211_key_conf *key); | 48 | struct ieee80211_key_conf *key); |
48 | int iwl_set_default_wep_key(struct iwl_priv *priv, | 49 | int iwl_set_default_wep_key(struct iwl_priv *priv, |
50 | struct iwl_rxon_context *ctx, | ||
49 | struct ieee80211_key_conf *key); | 51 | struct ieee80211_key_conf *key); |
50 | int iwl_restore_default_wep_keys(struct iwl_priv *priv); | 52 | int iwl_restore_default_wep_keys(struct iwl_priv *priv, |
51 | int iwl_set_dynamic_key(struct iwl_priv *priv, | 53 | struct iwl_rxon_context *ctx); |
54 | int iwl_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, | ||
52 | struct ieee80211_key_conf *key, u8 sta_id); | 55 | struct ieee80211_key_conf *key, u8 sta_id); |
53 | int iwl_remove_dynamic_key(struct iwl_priv *priv, | 56 | int iwl_remove_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
54 | struct ieee80211_key_conf *key, u8 sta_id); | 57 | struct ieee80211_key_conf *key, u8 sta_id); |
55 | void iwl_update_tkip_key(struct iwl_priv *priv, | 58 | void iwl_update_tkip_key(struct iwl_priv *priv, |
56 | struct ieee80211_key_conf *keyconf, | 59 | struct iwl_rxon_context *ctx, |
57 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); | 60 | struct ieee80211_key_conf *keyconf, |
58 | 61 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); | |
59 | void iwl_restore_stations(struct iwl_priv *priv); | 62 | |
60 | void iwl_clear_ucode_stations(struct iwl_priv *priv); | 63 | void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx); |
61 | int iwl_alloc_bcast_station(struct iwl_priv *priv, bool init_lq); | 64 | void iwl_clear_ucode_stations(struct iwl_priv *priv, |
62 | void iwl_dealloc_bcast_station(struct iwl_priv *priv); | 65 | struct iwl_rxon_context *ctx); |
63 | int iwl_update_bcast_station(struct iwl_priv *priv); | 66 | int iwl_alloc_bcast_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
67 | bool init_lq); | ||
68 | void iwl_dealloc_bcast_stations(struct iwl_priv *priv); | ||
69 | int iwl_update_bcast_stations(struct iwl_priv *priv); | ||
64 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv); | 70 | int iwl_get_free_ucode_key_index(struct iwl_priv *priv); |
65 | int iwl_send_add_sta(struct iwl_priv *priv, | 71 | int iwl_send_add_sta(struct iwl_priv *priv, |
66 | struct iwl_addsta_cmd *sta, u8 flags); | 72 | struct iwl_addsta_cmd *sta, u8 flags); |
67 | int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs, | 73 | int iwl_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
68 | u8 *sta_id_r); | 74 | const u8 *addr, bool init_rs, u8 *sta_id_r); |
69 | int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr, | 75 | int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, |
70 | bool is_ap, | 76 | const u8 *addr, bool is_ap, |
71 | struct ieee80211_sta_ht_cap *ht_info, | 77 | struct ieee80211_sta *sta, u8 *sta_id_r); |
72 | u8 *sta_id_r); | ||
73 | int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, | 78 | int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, |
74 | const u8 *addr); | 79 | const u8 *addr); |
75 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 80 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
@@ -94,20 +99,25 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt); | |||
94 | static inline void iwl_clear_driver_stations(struct iwl_priv *priv) | 99 | static inline void iwl_clear_driver_stations(struct iwl_priv *priv) |
95 | { | 100 | { |
96 | unsigned long flags; | 101 | unsigned long flags; |
102 | struct iwl_rxon_context *ctx; | ||
97 | 103 | ||
98 | spin_lock_irqsave(&priv->sta_lock, flags); | 104 | spin_lock_irqsave(&priv->sta_lock, flags); |
99 | memset(priv->stations, 0, sizeof(priv->stations)); | 105 | memset(priv->stations, 0, sizeof(priv->stations)); |
100 | priv->num_stations = 0; | 106 | priv->num_stations = 0; |
101 | 107 | ||
102 | /* | ||
103 | * Remove all key information that is not stored as part of station | ||
104 | * information since mac80211 may not have had a | ||
105 | * chance to remove all the keys. When device is reconfigured by | ||
106 | * mac80211 after an error all keys will be reconfigured. | ||
107 | */ | ||
108 | priv->ucode_key_table = 0; | 108 | priv->ucode_key_table = 0; |
109 | priv->key_mapping_key = 0; | 109 | |
110 | memset(priv->wep_keys, 0, sizeof(priv->wep_keys)); | 110 | for_each_context(priv, ctx) { |
111 | /* | ||
112 | * Remove all key information that is not stored as part | ||
113 | * of station information since mac80211 may not have had | ||
114 | * a chance to remove all the keys. When device is | ||
115 | * reconfigured by mac80211 after an error all keys will | ||
116 | * be reconfigured. | ||
117 | */ | ||
118 | memset(ctx->wep_keys, 0, sizeof(ctx->wep_keys)); | ||
119 | ctx->key_mapping_keys = 0; | ||
120 | } | ||
111 | 121 | ||
112 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 122 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
113 | } | 123 | } |
@@ -123,6 +133,7 @@ static inline int iwl_sta_id(struct ieee80211_sta *sta) | |||
123 | /** | 133 | /** |
124 | * iwl_sta_id_or_broadcast - return sta_id or broadcast sta | 134 | * iwl_sta_id_or_broadcast - return sta_id or broadcast sta |
125 | * @priv: iwl priv | 135 | * @priv: iwl priv |
136 | * @context: the current context | ||
126 | * @sta: mac80211 station | 137 | * @sta: mac80211 station |
127 | * | 138 | * |
128 | * In certain circumstances mac80211 passes a station pointer | 139 | * In certain circumstances mac80211 passes a station pointer |
@@ -131,12 +142,13 @@ static inline int iwl_sta_id(struct ieee80211_sta *sta) | |||
131 | * inline wraps that pattern. | 142 | * inline wraps that pattern. |
132 | */ | 143 | */ |
133 | static inline int iwl_sta_id_or_broadcast(struct iwl_priv *priv, | 144 | static inline int iwl_sta_id_or_broadcast(struct iwl_priv *priv, |
145 | struct iwl_rxon_context *context, | ||
134 | struct ieee80211_sta *sta) | 146 | struct ieee80211_sta *sta) |
135 | { | 147 | { |
136 | int sta_id; | 148 | int sta_id; |
137 | 149 | ||
138 | if (!sta) | 150 | if (!sta) |
139 | return priv->hw_params.bcast_sta_id; | 151 | return context->bcast_sta_id; |
140 | 152 | ||
141 | sta_id = iwl_sta_id(sta); | 153 | sta_id = iwl_sta_id(sta); |
142 | 154 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index c308dab14673..347d3dc6a015 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -134,7 +134,7 @@ EXPORT_SYMBOL(iwl_tx_queue_free); | |||
134 | */ | 134 | */ |
135 | void iwl_cmd_queue_free(struct iwl_priv *priv) | 135 | void iwl_cmd_queue_free(struct iwl_priv *priv) |
136 | { | 136 | { |
137 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 137 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; |
138 | struct iwl_queue *q = &txq->q; | 138 | struct iwl_queue *q = &txq->q; |
139 | struct device *dev = &priv->pci_dev->dev; | 139 | struct device *dev = &priv->pci_dev->dev; |
140 | int i; | 140 | int i; |
@@ -271,7 +271,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, | |||
271 | 271 | ||
272 | /* Driver private data, only for Tx (not command) queues, | 272 | /* Driver private data, only for Tx (not command) queues, |
273 | * not shared with device. */ | 273 | * not shared with device. */ |
274 | if (id != IWL_CMD_QUEUE_NUM) { | 274 | if (id != priv->cmd_queue) { |
275 | txq->txb = kzalloc(sizeof(txq->txb[0]) * | 275 | txq->txb = kzalloc(sizeof(txq->txb[0]) * |
276 | TFD_QUEUE_SIZE_MAX, GFP_KERNEL); | 276 | TFD_QUEUE_SIZE_MAX, GFP_KERNEL); |
277 | if (!txq->txb) { | 277 | if (!txq->txb) { |
@@ -314,13 +314,13 @@ int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, | |||
314 | 314 | ||
315 | /* | 315 | /* |
316 | * Alloc buffer array for commands (Tx or other types of commands). | 316 | * Alloc buffer array for commands (Tx or other types of commands). |
317 | * For the command queue (#4), allocate command space + one big | 317 | * For the command queue (#4/#9), allocate command space + one big |
318 | * command for scan, since scan command is very huge; the system will | 318 | * command for scan, since scan command is very huge; the system will |
319 | * not have two scans at the same time, so only one is needed. | 319 | * not have two scans at the same time, so only one is needed. |
320 | * For normal Tx queues (all other queues), no super-size command | 320 | * For normal Tx queues (all other queues), no super-size command |
321 | * space is needed. | 321 | * space is needed. |
322 | */ | 322 | */ |
323 | if (txq_id == IWL_CMD_QUEUE_NUM) | 323 | if (txq_id == priv->cmd_queue) |
324 | actual_slots++; | 324 | actual_slots++; |
325 | 325 | ||
326 | txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * actual_slots, | 326 | txq->meta = kzalloc(sizeof(struct iwl_cmd_meta) * actual_slots, |
@@ -355,7 +355,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq, | |||
355 | * need an swq_id so don't set one to catch errors, all others can | 355 | * need an swq_id so don't set one to catch errors, all others can |
356 | * be set up to the identity mapping. | 356 | * be set up to the identity mapping. |
357 | */ | 357 | */ |
358 | if (txq_id != IWL_CMD_QUEUE_NUM) | 358 | if (txq_id != priv->cmd_queue) |
359 | txq->swq_id = txq_id; | 359 | txq->swq_id = txq_id; |
360 | 360 | ||
361 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise | 361 | /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise |
@@ -385,7 +385,7 @@ void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, | |||
385 | { | 385 | { |
386 | int actual_slots = slots_num; | 386 | int actual_slots = slots_num; |
387 | 387 | ||
388 | if (txq_id == IWL_CMD_QUEUE_NUM) | 388 | if (txq_id == priv->cmd_queue) |
389 | actual_slots++; | 389 | actual_slots++; |
390 | 390 | ||
391 | memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * actual_slots); | 391 | memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * actual_slots); |
@@ -413,7 +413,7 @@ EXPORT_SYMBOL(iwl_tx_queue_reset); | |||
413 | */ | 413 | */ |
414 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | 414 | int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) |
415 | { | 415 | { |
416 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 416 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; |
417 | struct iwl_queue *q = &txq->q; | 417 | struct iwl_queue *q = &txq->q; |
418 | struct iwl_device_cmd *out_cmd; | 418 | struct iwl_device_cmd *out_cmd; |
419 | struct iwl_cmd_meta *out_meta; | 419 | struct iwl_cmd_meta *out_meta; |
@@ -483,7 +483,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
483 | * information */ | 483 | * information */ |
484 | 484 | ||
485 | out_cmd->hdr.flags = 0; | 485 | out_cmd->hdr.flags = 0; |
486 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | | 486 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) | |
487 | INDEX_TO_SEQ(q->write_ptr)); | 487 | INDEX_TO_SEQ(q->write_ptr)); |
488 | if (cmd->flags & CMD_SIZE_HUGE) | 488 | if (cmd->flags & CMD_SIZE_HUGE) |
489 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; | 489 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; |
@@ -500,15 +500,15 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
500 | get_cmd_string(out_cmd->hdr.cmd), | 500 | get_cmd_string(out_cmd->hdr.cmd), |
501 | out_cmd->hdr.cmd, | 501 | out_cmd->hdr.cmd, |
502 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, | 502 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, |
503 | q->write_ptr, idx, IWL_CMD_QUEUE_NUM); | 503 | q->write_ptr, idx, priv->cmd_queue); |
504 | break; | 504 | break; |
505 | default: | 505 | default: |
506 | IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " | 506 | IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " |
507 | "%d bytes at %d[%d]:%d\n", | 507 | "%d bytes at %d[%d]:%d\n", |
508 | get_cmd_string(out_cmd->hdr.cmd), | 508 | get_cmd_string(out_cmd->hdr.cmd), |
509 | out_cmd->hdr.cmd, | 509 | out_cmd->hdr.cmd, |
510 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, | 510 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, |
511 | q->write_ptr, idx, IWL_CMD_QUEUE_NUM); | 511 | q->write_ptr, idx, priv->cmd_queue); |
512 | } | 512 | } |
513 | #endif | 513 | #endif |
514 | txq->need_update = 1; | 514 | txq->need_update = 1; |
@@ -587,16 +587,16 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
587 | bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); | 587 | bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); |
588 | struct iwl_device_cmd *cmd; | 588 | struct iwl_device_cmd *cmd; |
589 | struct iwl_cmd_meta *meta; | 589 | struct iwl_cmd_meta *meta; |
590 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 590 | struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue]; |
591 | 591 | ||
592 | /* If a Tx command is being handled and it isn't in the actual | 592 | /* If a Tx command is being handled and it isn't in the actual |
593 | * command queue then there a command routing bug has been introduced | 593 | * command queue then there a command routing bug has been introduced |
594 | * in the queue management code. */ | 594 | * in the queue management code. */ |
595 | if (WARN(txq_id != IWL_CMD_QUEUE_NUM, | 595 | if (WARN(txq_id != priv->cmd_queue, |
596 | "wrong command queue %d, sequence 0x%X readp=%d writep=%d\n", | 596 | "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n", |
597 | txq_id, sequence, | 597 | txq_id, priv->cmd_queue, sequence, |
598 | priv->txq[IWL_CMD_QUEUE_NUM].q.read_ptr, | 598 | priv->txq[priv->cmd_queue].q.read_ptr, |
599 | priv->txq[IWL_CMD_QUEUE_NUM].q.write_ptr)) { | 599 | priv->txq[priv->cmd_queue].q.write_ptr)) { |
600 | iwl_print_hex_error(priv, pkt, 32); | 600 | iwl_print_hex_error(priv, pkt, 32); |
601 | return; | 601 | return; |
602 | } | 602 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 94d7e6e1323d..68e624afb987 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -144,7 +144,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, | |||
144 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); | 144 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); |
145 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 145 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
146 | 146 | ||
147 | if (sta_id == priv->hw_params.bcast_sta_id) | 147 | if (sta_id == priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id) |
148 | key_flags |= STA_KEY_MULTICAST_MSK; | 148 | key_flags |= STA_KEY_MULTICAST_MSK; |
149 | 149 | ||
150 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 150 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
@@ -317,7 +317,7 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, | |||
317 | int left) | 317 | int left) |
318 | { | 318 | { |
319 | 319 | ||
320 | if (!iwl_is_associated(priv) || !priv->ibss_beacon) | 320 | if (!iwl_is_associated(priv, IWL_RXON_CTX_BSS) || !priv->ibss_beacon) |
321 | return 0; | 321 | return 0; |
322 | 322 | ||
323 | if (priv->ibss_beacon->len > left) | 323 | if (priv->ibss_beacon->len > left) |
@@ -343,7 +343,8 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) | |||
343 | return -ENOMEM; | 343 | return -ENOMEM; |
344 | } | 344 | } |
345 | 345 | ||
346 | rate = iwl_rate_get_lowest_plcp(priv); | 346 | rate = iwl_rate_get_lowest_plcp(priv, |
347 | &priv->contexts[IWL_RXON_CTX_BSS]); | ||
347 | 348 | ||
348 | frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); | 349 | frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); |
349 | 350 | ||
@@ -512,7 +513,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
512 | hdr_len = ieee80211_hdrlen(fc); | 513 | hdr_len = ieee80211_hdrlen(fc); |
513 | 514 | ||
514 | /* Find index into station table for destination station */ | 515 | /* Find index into station table for destination station */ |
515 | sta_id = iwl_sta_id_or_broadcast(priv, info->control.sta); | 516 | sta_id = iwl_sta_id_or_broadcast( |
517 | priv, &priv->contexts[IWL_RXON_CTX_BSS], | ||
518 | info->control.sta); | ||
516 | if (sta_id == IWL_INVALID_STATION) { | 519 | if (sta_id == IWL_INVALID_STATION) { |
517 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 520 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
518 | hdr->addr1); | 521 | hdr->addr1); |
@@ -542,6 +545,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
542 | /* Set up driver data for this TFD */ | 545 | /* Set up driver data for this TFD */ |
543 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); | 546 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); |
544 | txq->txb[q->write_ptr].skb = skb; | 547 | txq->txb[q->write_ptr].skb = skb; |
548 | txq->txb[q->write_ptr].ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
545 | 549 | ||
546 | /* Init first empty entry in queue's array of Tx/cmd buffers */ | 550 | /* Init first empty entry in queue's array of Tx/cmd buffers */ |
547 | out_cmd = txq->cmd[idx]; | 551 | out_cmd = txq->cmd[idx]; |
@@ -683,11 +687,12 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
683 | int rc; | 687 | int rc; |
684 | int spectrum_resp_status; | 688 | int spectrum_resp_status; |
685 | int duration = le16_to_cpu(params->duration); | 689 | int duration = le16_to_cpu(params->duration); |
690 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
686 | 691 | ||
687 | if (iwl_is_associated(priv)) | 692 | if (iwl_is_associated(priv, IWL_RXON_CTX_BSS)) |
688 | add_time = iwl_usecs_to_beacons(priv, | 693 | add_time = iwl_usecs_to_beacons(priv, |
689 | le64_to_cpu(params->start_time) - priv->_3945.last_tsf, | 694 | le64_to_cpu(params->start_time) - priv->_3945.last_tsf, |
690 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | 695 | le16_to_cpu(ctx->timing.beacon_interval)); |
691 | 696 | ||
692 | memset(&spectrum, 0, sizeof(spectrum)); | 697 | memset(&spectrum, 0, sizeof(spectrum)); |
693 | 698 | ||
@@ -698,18 +703,18 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
698 | cmd.len = sizeof(spectrum); | 703 | cmd.len = sizeof(spectrum); |
699 | spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); | 704 | spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); |
700 | 705 | ||
701 | if (iwl_is_associated(priv)) | 706 | if (iwl_is_associated(priv, IWL_RXON_CTX_BSS)) |
702 | spectrum.start_time = | 707 | spectrum.start_time = |
703 | iwl_add_beacon_time(priv, | 708 | iwl_add_beacon_time(priv, |
704 | priv->_3945.last_beacon_time, add_time, | 709 | priv->_3945.last_beacon_time, add_time, |
705 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | 710 | le16_to_cpu(ctx->timing.beacon_interval)); |
706 | else | 711 | else |
707 | spectrum.start_time = 0; | 712 | spectrum.start_time = 0; |
708 | 713 | ||
709 | spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); | 714 | spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); |
710 | spectrum.channels[0].channel = params->channel; | 715 | spectrum.channels[0].channel = params->channel; |
711 | spectrum.channels[0].type = type; | 716 | spectrum.channels[0].type = type; |
712 | if (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK) | 717 | if (ctx->active.flags & RXON_FLG_BAND_24G_MSK) |
713 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | | 718 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | |
714 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; | 719 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; |
715 | 720 | ||
@@ -798,7 +803,8 @@ static void iwl3945_bg_beacon_update(struct work_struct *work) | |||
798 | struct sk_buff *beacon; | 803 | struct sk_buff *beacon; |
799 | 804 | ||
800 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 805 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ |
801 | beacon = ieee80211_beacon_get(priv->hw, priv->vif); | 806 | beacon = ieee80211_beacon_get(priv->hw, |
807 | priv->contexts[IWL_RXON_CTX_BSS].vif); | ||
802 | 808 | ||
803 | if (!beacon) { | 809 | if (!beacon) { |
804 | IWL_ERR(priv, "update beacon failed\n"); | 810 | IWL_ERR(priv, "update beacon failed\n"); |
@@ -2468,6 +2474,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2468 | { | 2474 | { |
2469 | int thermal_spin = 0; | 2475 | int thermal_spin = 0; |
2470 | u32 rfkill; | 2476 | u32 rfkill; |
2477 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
2471 | 2478 | ||
2472 | IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 2479 | IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); |
2473 | 2480 | ||
@@ -2525,22 +2532,22 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2525 | 2532 | ||
2526 | iwl_power_update_mode(priv, true); | 2533 | iwl_power_update_mode(priv, true); |
2527 | 2534 | ||
2528 | if (iwl_is_associated(priv)) { | 2535 | if (iwl_is_associated(priv, IWL_RXON_CTX_BSS)) { |
2529 | struct iwl3945_rxon_cmd *active_rxon = | 2536 | struct iwl3945_rxon_cmd *active_rxon = |
2530 | (struct iwl3945_rxon_cmd *)(&priv->active_rxon); | 2537 | (struct iwl3945_rxon_cmd *)(&ctx->active); |
2531 | 2538 | ||
2532 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2539 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2533 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2540 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2534 | } else { | 2541 | } else { |
2535 | /* Initialize our rx_config data */ | 2542 | /* Initialize our rx_config data */ |
2536 | iwl_connection_init_rx_config(priv, NULL); | 2543 | iwl_connection_init_rx_config(priv, ctx); |
2537 | } | 2544 | } |
2538 | 2545 | ||
2539 | /* Configure Bluetooth device coexistence support */ | 2546 | /* Configure Bluetooth device coexistence support */ |
2540 | priv->cfg->ops->hcmd->send_bt_config(priv); | 2547 | priv->cfg->ops->hcmd->send_bt_config(priv); |
2541 | 2548 | ||
2542 | /* Configure the adapter for unassociated operation */ | 2549 | /* Configure the adapter for unassociated operation */ |
2543 | iwlcore_commit_rxon(priv); | 2550 | iwlcore_commit_rxon(priv, ctx); |
2544 | 2551 | ||
2545 | iwl3945_reg_txpower_periodic(priv); | 2552 | iwl3945_reg_txpower_periodic(priv); |
2546 | 2553 | ||
@@ -2571,9 +2578,14 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
2571 | if (!exit_pending) | 2578 | if (!exit_pending) |
2572 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2579 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
2573 | 2580 | ||
2581 | /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set | ||
2582 | * to prevent rearm timer */ | ||
2583 | if (priv->cfg->ops->lib->recover_from_tx_stall) | ||
2584 | del_timer_sync(&priv->monitor_recover); | ||
2585 | |||
2574 | /* Station information will now be cleared in device */ | 2586 | /* Station information will now be cleared in device */ |
2575 | iwl_clear_ucode_stations(priv); | 2587 | iwl_clear_ucode_stations(priv, NULL); |
2576 | iwl_dealloc_bcast_station(priv); | 2588 | iwl_dealloc_bcast_stations(priv); |
2577 | iwl_clear_driver_stations(priv); | 2589 | iwl_clear_driver_stations(priv); |
2578 | 2590 | ||
2579 | /* Unblock any waiting calls */ | 2591 | /* Unblock any waiting calls */ |
@@ -2655,7 +2667,8 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
2655 | { | 2667 | { |
2656 | int rc, i; | 2668 | int rc, i; |
2657 | 2669 | ||
2658 | rc = iwl_alloc_bcast_station(priv, false); | 2670 | rc = iwl_alloc_bcast_station(priv, &priv->contexts[IWL_RXON_CTX_BSS], |
2671 | false); | ||
2659 | if (rc) | 2672 | if (rc) |
2660 | return rc; | 2673 | return rc; |
2661 | 2674 | ||
@@ -2878,7 +2891,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2878 | scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; | 2891 | scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; |
2879 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; | 2892 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; |
2880 | 2893 | ||
2881 | if (iwl_is_associated(priv)) { | 2894 | if (iwl_is_associated(priv, IWL_RXON_CTX_BSS)) { |
2882 | u16 interval = 0; | 2895 | u16 interval = 0; |
2883 | u32 extra; | 2896 | u32 extra; |
2884 | u32 suspend_time = 100; | 2897 | u32 suspend_time = 100; |
@@ -2939,7 +2952,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2939 | /* We don't build a direct scan probe request; the uCode will do | 2952 | /* We don't build a direct scan probe request; the uCode will do |
2940 | * that based on the direct_mask added to each channel entry */ | 2953 | * that based on the direct_mask added to each channel entry */ |
2941 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 2954 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
2942 | scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; | 2955 | scan->tx_cmd.sta_id = priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id; |
2943 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 2956 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
2944 | 2957 | ||
2945 | /* flags + rate selection */ | 2958 | /* flags + rate selection */ |
@@ -3037,8 +3050,10 @@ static void iwl3945_bg_restart(struct work_struct *data) | |||
3037 | return; | 3050 | return; |
3038 | 3051 | ||
3039 | if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { | 3052 | if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { |
3053 | struct iwl_rxon_context *ctx; | ||
3040 | mutex_lock(&priv->mutex); | 3054 | mutex_lock(&priv->mutex); |
3041 | priv->vif = NULL; | 3055 | for_each_context(priv, ctx) |
3056 | ctx->vif = NULL; | ||
3042 | priv->is_open = 0; | 3057 | priv->is_open = 0; |
3043 | mutex_unlock(&priv->mutex); | 3058 | mutex_unlock(&priv->mutex); |
3044 | iwl3945_down(priv); | 3059 | iwl3945_down(priv); |
@@ -3072,6 +3087,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3072 | { | 3087 | { |
3073 | int rc = 0; | 3088 | int rc = 0; |
3074 | struct ieee80211_conf *conf = NULL; | 3089 | struct ieee80211_conf *conf = NULL; |
3090 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3075 | 3091 | ||
3076 | if (!vif || !priv->is_open) | 3092 | if (!vif || !priv->is_open) |
3077 | return; | 3093 | return; |
@@ -3082,7 +3098,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3082 | } | 3098 | } |
3083 | 3099 | ||
3084 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 3100 | IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", |
3085 | vif->bss_conf.aid, priv->active_rxon.bssid_addr); | 3101 | vif->bss_conf.aid, ctx->active.bssid_addr); |
3086 | 3102 | ||
3087 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3103 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3088 | return; | 3104 | return; |
@@ -3091,34 +3107,34 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3091 | 3107 | ||
3092 | conf = ieee80211_get_hw_conf(priv->hw); | 3108 | conf = ieee80211_get_hw_conf(priv->hw); |
3093 | 3109 | ||
3094 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3110 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3095 | iwlcore_commit_rxon(priv); | 3111 | iwlcore_commit_rxon(priv, ctx); |
3096 | 3112 | ||
3097 | rc = iwl_send_rxon_timing(priv, vif); | 3113 | rc = iwl_send_rxon_timing(priv, ctx); |
3098 | if (rc) | 3114 | if (rc) |
3099 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 3115 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " |
3100 | "Attempting to continue.\n"); | 3116 | "Attempting to continue.\n"); |
3101 | 3117 | ||
3102 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3118 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3103 | 3119 | ||
3104 | priv->staging_rxon.assoc_id = cpu_to_le16(vif->bss_conf.aid); | 3120 | ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
3105 | 3121 | ||
3106 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 3122 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
3107 | vif->bss_conf.aid, vif->bss_conf.beacon_int); | 3123 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
3108 | 3124 | ||
3109 | if (vif->bss_conf.use_short_preamble) | 3125 | if (vif->bss_conf.use_short_preamble) |
3110 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 3126 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
3111 | else | 3127 | else |
3112 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3128 | ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3113 | 3129 | ||
3114 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3130 | if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { |
3115 | if (vif->bss_conf.use_short_slot) | 3131 | if (vif->bss_conf.use_short_slot) |
3116 | priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; | 3132 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
3117 | else | 3133 | else |
3118 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 3134 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
3119 | } | 3135 | } |
3120 | 3136 | ||
3121 | iwlcore_commit_rxon(priv); | 3137 | iwlcore_commit_rxon(priv, ctx); |
3122 | 3138 | ||
3123 | switch (vif->type) { | 3139 | switch (vif->type) { |
3124 | case NL80211_IFTYPE_STATION: | 3140 | case NL80211_IFTYPE_STATION: |
@@ -3255,44 +3271,45 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3255 | 3271 | ||
3256 | void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) | 3272 | void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) |
3257 | { | 3273 | { |
3274 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3258 | int rc = 0; | 3275 | int rc = 0; |
3259 | 3276 | ||
3260 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 3277 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
3261 | return; | 3278 | return; |
3262 | 3279 | ||
3263 | /* The following should be done only at AP bring up */ | 3280 | /* The following should be done only at AP bring up */ |
3264 | if (!(iwl_is_associated(priv))) { | 3281 | if (!(iwl_is_associated(priv, IWL_RXON_CTX_BSS))) { |
3265 | 3282 | ||
3266 | /* RXON - unassoc (to set timing command) */ | 3283 | /* RXON - unassoc (to set timing command) */ |
3267 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3284 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3268 | iwlcore_commit_rxon(priv); | 3285 | iwlcore_commit_rxon(priv, ctx); |
3269 | 3286 | ||
3270 | /* RXON Timing */ | 3287 | /* RXON Timing */ |
3271 | rc = iwl_send_rxon_timing(priv, vif); | 3288 | rc = iwl_send_rxon_timing(priv, ctx); |
3272 | if (rc) | 3289 | if (rc) |
3273 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 3290 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " |
3274 | "Attempting to continue.\n"); | 3291 | "Attempting to continue.\n"); |
3275 | 3292 | ||
3276 | priv->staging_rxon.assoc_id = 0; | 3293 | ctx->staging.assoc_id = 0; |
3277 | 3294 | ||
3278 | if (vif->bss_conf.use_short_preamble) | 3295 | if (vif->bss_conf.use_short_preamble) |
3279 | priv->staging_rxon.flags |= | 3296 | ctx->staging.flags |= |
3280 | RXON_FLG_SHORT_PREAMBLE_MSK; | 3297 | RXON_FLG_SHORT_PREAMBLE_MSK; |
3281 | else | 3298 | else |
3282 | priv->staging_rxon.flags &= | 3299 | ctx->staging.flags &= |
3283 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | 3300 | ~RXON_FLG_SHORT_PREAMBLE_MSK; |
3284 | 3301 | ||
3285 | if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) { | 3302 | if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { |
3286 | if (vif->bss_conf.use_short_slot) | 3303 | if (vif->bss_conf.use_short_slot) |
3287 | priv->staging_rxon.flags |= | 3304 | ctx->staging.flags |= |
3288 | RXON_FLG_SHORT_SLOT_MSK; | 3305 | RXON_FLG_SHORT_SLOT_MSK; |
3289 | else | 3306 | else |
3290 | priv->staging_rxon.flags &= | 3307 | ctx->staging.flags &= |
3291 | ~RXON_FLG_SHORT_SLOT_MSK; | 3308 | ~RXON_FLG_SHORT_SLOT_MSK; |
3292 | } | 3309 | } |
3293 | /* restore RXON assoc */ | 3310 | /* restore RXON assoc */ |
3294 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3311 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3295 | iwlcore_commit_rxon(priv); | 3312 | iwlcore_commit_rxon(priv, ctx); |
3296 | } | 3313 | } |
3297 | iwl3945_send_beacon_cmd(priv); | 3314 | iwl3945_send_beacon_cmd(priv); |
3298 | 3315 | ||
@@ -3318,10 +3335,11 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3318 | return -EOPNOTSUPP; | 3335 | return -EOPNOTSUPP; |
3319 | } | 3336 | } |
3320 | 3337 | ||
3321 | static_key = !iwl_is_associated(priv); | 3338 | static_key = !iwl_is_associated(priv, IWL_RXON_CTX_BSS); |
3322 | 3339 | ||
3323 | if (!static_key) { | 3340 | if (!static_key) { |
3324 | sta_id = iwl_sta_id_or_broadcast(priv, sta); | 3341 | sta_id = iwl_sta_id_or_broadcast( |
3342 | priv, &priv->contexts[IWL_RXON_CTX_BSS], sta); | ||
3325 | if (sta_id == IWL_INVALID_STATION) | 3343 | if (sta_id == IWL_INVALID_STATION) |
3326 | return -EINVAL; | 3344 | return -EINVAL; |
3327 | } | 3345 | } |
@@ -3372,8 +3390,8 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3372 | sta_priv->common.sta_id = IWL_INVALID_STATION; | 3390 | sta_priv->common.sta_id = IWL_INVALID_STATION; |
3373 | 3391 | ||
3374 | 3392 | ||
3375 | ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, | 3393 | ret = iwl_add_station_common(priv, &priv->contexts[IWL_RXON_CTX_BSS], |
3376 | &sta_id); | 3394 | sta->addr, is_ap, sta, &sta_id); |
3377 | if (ret) { | 3395 | if (ret) { |
3378 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", | 3396 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", |
3379 | sta->addr, ret); | 3397 | sta->addr, ret); |
@@ -3400,6 +3418,7 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, | |||
3400 | { | 3418 | { |
3401 | struct iwl_priv *priv = hw->priv; | 3419 | struct iwl_priv *priv = hw->priv; |
3402 | __le32 filter_or = 0, filter_nand = 0; | 3420 | __le32 filter_or = 0, filter_nand = 0; |
3421 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3403 | 3422 | ||
3404 | #define CHK(test, flag) do { \ | 3423 | #define CHK(test, flag) do { \ |
3405 | if (*total_flags & (test)) \ | 3424 | if (*total_flags & (test)) \ |
@@ -3419,8 +3438,8 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw, | |||
3419 | 3438 | ||
3420 | mutex_lock(&priv->mutex); | 3439 | mutex_lock(&priv->mutex); |
3421 | 3440 | ||
3422 | priv->staging_rxon.filter_flags &= ~filter_nand; | 3441 | ctx->staging.filter_flags &= ~filter_nand; |
3423 | priv->staging_rxon.filter_flags |= filter_or; | 3442 | ctx->staging.filter_flags |= filter_or; |
3424 | 3443 | ||
3425 | /* | 3444 | /* |
3426 | * Committing directly here breaks for some reason, | 3445 | * Committing directly here breaks for some reason, |
@@ -3534,8 +3553,9 @@ static ssize_t show_flags(struct device *d, | |||
3534 | struct device_attribute *attr, char *buf) | 3553 | struct device_attribute *attr, char *buf) |
3535 | { | 3554 | { |
3536 | struct iwl_priv *priv = dev_get_drvdata(d); | 3555 | struct iwl_priv *priv = dev_get_drvdata(d); |
3556 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3537 | 3557 | ||
3538 | return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); | 3558 | return sprintf(buf, "0x%04X\n", ctx->active.flags); |
3539 | } | 3559 | } |
3540 | 3560 | ||
3541 | static ssize_t store_flags(struct device *d, | 3561 | static ssize_t store_flags(struct device *d, |
@@ -3544,17 +3564,18 @@ static ssize_t store_flags(struct device *d, | |||
3544 | { | 3564 | { |
3545 | struct iwl_priv *priv = dev_get_drvdata(d); | 3565 | struct iwl_priv *priv = dev_get_drvdata(d); |
3546 | u32 flags = simple_strtoul(buf, NULL, 0); | 3566 | u32 flags = simple_strtoul(buf, NULL, 0); |
3567 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3547 | 3568 | ||
3548 | mutex_lock(&priv->mutex); | 3569 | mutex_lock(&priv->mutex); |
3549 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { | 3570 | if (le32_to_cpu(ctx->staging.flags) != flags) { |
3550 | /* Cancel any currently running scans... */ | 3571 | /* Cancel any currently running scans... */ |
3551 | if (iwl_scan_cancel_timeout(priv, 100)) | 3572 | if (iwl_scan_cancel_timeout(priv, 100)) |
3552 | IWL_WARN(priv, "Could not cancel scan.\n"); | 3573 | IWL_WARN(priv, "Could not cancel scan.\n"); |
3553 | else { | 3574 | else { |
3554 | IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", | 3575 | IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", |
3555 | flags); | 3576 | flags); |
3556 | priv->staging_rxon.flags = cpu_to_le32(flags); | 3577 | ctx->staging.flags = cpu_to_le32(flags); |
3557 | iwlcore_commit_rxon(priv); | 3578 | iwlcore_commit_rxon(priv, ctx); |
3558 | } | 3579 | } |
3559 | } | 3580 | } |
3560 | mutex_unlock(&priv->mutex); | 3581 | mutex_unlock(&priv->mutex); |
@@ -3568,9 +3589,10 @@ static ssize_t show_filter_flags(struct device *d, | |||
3568 | struct device_attribute *attr, char *buf) | 3589 | struct device_attribute *attr, char *buf) |
3569 | { | 3590 | { |
3570 | struct iwl_priv *priv = dev_get_drvdata(d); | 3591 | struct iwl_priv *priv = dev_get_drvdata(d); |
3592 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3571 | 3593 | ||
3572 | return sprintf(buf, "0x%04X\n", | 3594 | return sprintf(buf, "0x%04X\n", |
3573 | le32_to_cpu(priv->active_rxon.filter_flags)); | 3595 | le32_to_cpu(ctx->active.filter_flags)); |
3574 | } | 3596 | } |
3575 | 3597 | ||
3576 | static ssize_t store_filter_flags(struct device *d, | 3598 | static ssize_t store_filter_flags(struct device *d, |
@@ -3578,19 +3600,20 @@ static ssize_t store_filter_flags(struct device *d, | |||
3578 | const char *buf, size_t count) | 3600 | const char *buf, size_t count) |
3579 | { | 3601 | { |
3580 | struct iwl_priv *priv = dev_get_drvdata(d); | 3602 | struct iwl_priv *priv = dev_get_drvdata(d); |
3603 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3581 | u32 filter_flags = simple_strtoul(buf, NULL, 0); | 3604 | u32 filter_flags = simple_strtoul(buf, NULL, 0); |
3582 | 3605 | ||
3583 | mutex_lock(&priv->mutex); | 3606 | mutex_lock(&priv->mutex); |
3584 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { | 3607 | if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { |
3585 | /* Cancel any currently running scans... */ | 3608 | /* Cancel any currently running scans... */ |
3586 | if (iwl_scan_cancel_timeout(priv, 100)) | 3609 | if (iwl_scan_cancel_timeout(priv, 100)) |
3587 | IWL_WARN(priv, "Could not cancel scan.\n"); | 3610 | IWL_WARN(priv, "Could not cancel scan.\n"); |
3588 | else { | 3611 | else { |
3589 | IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " | 3612 | IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " |
3590 | "0x%04X\n", filter_flags); | 3613 | "0x%04X\n", filter_flags); |
3591 | priv->staging_rxon.filter_flags = | 3614 | ctx->staging.filter_flags = |
3592 | cpu_to_le32(filter_flags); | 3615 | cpu_to_le32(filter_flags); |
3593 | iwlcore_commit_rxon(priv); | 3616 | iwlcore_commit_rxon(priv, ctx); |
3594 | } | 3617 | } |
3595 | } | 3618 | } |
3596 | mutex_unlock(&priv->mutex); | 3619 | mutex_unlock(&priv->mutex); |
@@ -3638,8 +3661,9 @@ static ssize_t store_measurement(struct device *d, | |||
3638 | const char *buf, size_t count) | 3661 | const char *buf, size_t count) |
3639 | { | 3662 | { |
3640 | struct iwl_priv *priv = dev_get_drvdata(d); | 3663 | struct iwl_priv *priv = dev_get_drvdata(d); |
3664 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
3641 | struct ieee80211_measurement_params params = { | 3665 | struct ieee80211_measurement_params params = { |
3642 | .channel = le16_to_cpu(priv->active_rxon.channel), | 3666 | .channel = le16_to_cpu(ctx->active.channel), |
3643 | .start_time = cpu_to_le64(priv->_3945.last_tsf), | 3667 | .start_time = cpu_to_le64(priv->_3945.last_tsf), |
3644 | .duration = cpu_to_le16(1), | 3668 | .duration = cpu_to_le16(1), |
3645 | }; | 3669 | }; |
@@ -3811,8 +3835,6 @@ static void iwl3945_cancel_deferred_work(struct iwl_priv *priv) | |||
3811 | cancel_delayed_work(&priv->alive_start); | 3835 | cancel_delayed_work(&priv->alive_start); |
3812 | cancel_work_sync(&priv->start_internal_scan); | 3836 | cancel_work_sync(&priv->start_internal_scan); |
3813 | cancel_work_sync(&priv->beacon_update); | 3837 | cancel_work_sync(&priv->beacon_update); |
3814 | if (priv->cfg->ops->lib->recover_from_tx_stall) | ||
3815 | del_timer_sync(&priv->monitor_recover); | ||
3816 | } | 3838 | } |
3817 | 3839 | ||
3818 | static struct attribute *iwl3945_sysfs_entries[] = { | 3840 | static struct attribute *iwl3945_sysfs_entries[] = { |
@@ -3933,8 +3955,7 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3933 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 3955 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; |
3934 | 3956 | ||
3935 | hw->wiphy->interface_modes = | 3957 | hw->wiphy->interface_modes = |
3936 | BIT(NL80211_IFTYPE_STATION) | | 3958 | priv->contexts[IWL_RXON_CTX_BSS].interface_modes; |
3937 | BIT(NL80211_IFTYPE_ADHOC); | ||
3938 | 3959 | ||
3939 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 3960 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | |
3940 | WIPHY_FLAG_DISABLE_BEACON_HINTS; | 3961 | WIPHY_FLAG_DISABLE_BEACON_HINTS; |
@@ -3966,7 +3987,7 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3966 | 3987 | ||
3967 | static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 3988 | static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
3968 | { | 3989 | { |
3969 | int err = 0; | 3990 | int err = 0, i; |
3970 | struct iwl_priv *priv; | 3991 | struct iwl_priv *priv; |
3971 | struct ieee80211_hw *hw; | 3992 | struct ieee80211_hw *hw; |
3972 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 3993 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
@@ -3988,6 +4009,27 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
3988 | priv = hw->priv; | 4009 | priv = hw->priv; |
3989 | SET_IEEE80211_DEV(hw, &pdev->dev); | 4010 | SET_IEEE80211_DEV(hw, &pdev->dev); |
3990 | 4011 | ||
4012 | priv->cmd_queue = IWL39_CMD_QUEUE_NUM; | ||
4013 | |||
4014 | /* 3945 has only one valid context */ | ||
4015 | priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); | ||
4016 | |||
4017 | for (i = 0; i < NUM_IWL_RXON_CTX; i++) | ||
4018 | priv->contexts[i].ctxid = i; | ||
4019 | |||
4020 | priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; | ||
4021 | priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; | ||
4022 | priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; | ||
4023 | priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; | ||
4024 | priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; | ||
4025 | priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; | ||
4026 | priv->contexts[IWL_RXON_CTX_BSS].interface_modes = | ||
4027 | BIT(NL80211_IFTYPE_STATION) | | ||
4028 | BIT(NL80211_IFTYPE_ADHOC); | ||
4029 | priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; | ||
4030 | priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; | ||
4031 | priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; | ||
4032 | |||
3991 | /* | 4033 | /* |
3992 | * Disabling hardware scan means that mac80211 will perform scans | 4034 | * Disabling hardware scan means that mac80211 will perform scans |
3993 | * "the hard way", rather than using device's scan. | 4035 | * "the hard way", rather than using device's scan. |
@@ -4123,7 +4165,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4123 | } | 4165 | } |
4124 | 4166 | ||
4125 | iwl_set_rxon_channel(priv, | 4167 | iwl_set_rxon_channel(priv, |
4126 | &priv->bands[IEEE80211_BAND_2GHZ].channels[5]); | 4168 | &priv->bands[IEEE80211_BAND_2GHZ].channels[5], |
4169 | &priv->contexts[IWL_RXON_CTX_BSS]); | ||
4127 | iwl3945_setup_deferred_work(priv); | 4170 | iwl3945_setup_deferred_work(priv); |
4128 | iwl3945_setup_rx_handlers(priv); | 4171 | iwl3945_setup_rx_handlers(priv); |
4129 | iwl_power_initialize(priv); | 4172 | iwl_power_initialize(priv); |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 298ba79fc51b..92b486d46eb9 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -601,6 +601,18 @@ static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, | |||
601 | } | 601 | } |
602 | 602 | ||
603 | 603 | ||
604 | static int mac80211_hwsim_change_interface(struct ieee80211_hw *hw, | ||
605 | struct ieee80211_vif *vif, | ||
606 | enum nl80211_iftype newtype) | ||
607 | { | ||
608 | wiphy_debug(hw->wiphy, | ||
609 | "%s (old type=%d, new type=%d, mac_addr=%pM)\n", | ||
610 | __func__, vif->type, newtype, vif->addr); | ||
611 | hwsim_check_magic(vif); | ||
612 | |||
613 | return 0; | ||
614 | } | ||
615 | |||
604 | static void mac80211_hwsim_remove_interface( | 616 | static void mac80211_hwsim_remove_interface( |
605 | struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 617 | struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
606 | { | 618 | { |
@@ -1027,6 +1039,7 @@ static struct ieee80211_ops mac80211_hwsim_ops = | |||
1027 | .start = mac80211_hwsim_start, | 1039 | .start = mac80211_hwsim_start, |
1028 | .stop = mac80211_hwsim_stop, | 1040 | .stop = mac80211_hwsim_stop, |
1029 | .add_interface = mac80211_hwsim_add_interface, | 1041 | .add_interface = mac80211_hwsim_add_interface, |
1042 | .change_interface = mac80211_hwsim_change_interface, | ||
1030 | .remove_interface = mac80211_hwsim_remove_interface, | 1043 | .remove_interface = mac80211_hwsim_remove_interface, |
1031 | .config = mac80211_hwsim_config, | 1044 | .config = mac80211_hwsim_config, |
1032 | .configure_filter = mac80211_hwsim_configure_filter, | 1045 | .configure_filter = mac80211_hwsim_configure_filter, |
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 077baa86756b..b4772c1c6135 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -762,14 +762,17 @@ int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate) | |||
762 | case FIRMWARE_TYPE_INTERSIL: /* Intersil style rate */ | 762 | case FIRMWARE_TYPE_INTERSIL: /* Intersil style rate */ |
763 | case FIRMWARE_TYPE_SYMBOL: /* Symbol style rate */ | 763 | case FIRMWARE_TYPE_SYMBOL: /* Symbol style rate */ |
764 | for (i = 0; i < BITRATE_TABLE_SIZE; i++) | 764 | for (i = 0; i < BITRATE_TABLE_SIZE; i++) |
765 | if (bitrate_table[i].intersil_txratectrl == val) | 765 | if (bitrate_table[i].intersil_txratectrl == val) { |
766 | *bitrate = bitrate_table[i].bitrate * 100000; | ||
766 | break; | 767 | break; |
768 | } | ||
767 | 769 | ||
768 | if (i >= BITRATE_TABLE_SIZE) | 770 | if (i >= BITRATE_TABLE_SIZE) { |
769 | printk(KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n", | 771 | printk(KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n", |
770 | priv->ndev->name, val); | 772 | priv->ndev->name, val); |
773 | err = -EIO; | ||
774 | } | ||
771 | 775 | ||
772 | *bitrate = bitrate_table[i].bitrate * 100000; | ||
773 | break; | 776 | break; |
774 | default: | 777 | default: |
775 | BUG(); | 778 | BUG(); |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index cf7be1eb6124..93505f93bf97 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -589,8 +589,15 @@ static int orinoco_ioctl_getrate(struct net_device *dev, | |||
589 | 589 | ||
590 | /* If the interface is running we try to find more about the | 590 | /* If the interface is running we try to find more about the |
591 | current mode */ | 591 | current mode */ |
592 | if (netif_running(dev)) | 592 | if (netif_running(dev)) { |
593 | err = orinoco_hw_get_act_bitrate(priv, &bitrate); | 593 | int act_bitrate; |
594 | int lerr; | ||
595 | |||
596 | /* Ignore errors if we can't get the actual bitrate */ | ||
597 | lerr = orinoco_hw_get_act_bitrate(priv, &act_bitrate); | ||
598 | if (!lerr) | ||
599 | bitrate = act_bitrate; | ||
600 | } | ||
594 | 601 | ||
595 | orinoco_unlock(priv, &flags); | 602 | orinoco_unlock(priv, &flags); |
596 | 603 | ||
diff --git a/drivers/net/wireless/p54/Kconfig b/drivers/net/wireless/p54/Kconfig index 60a930e45a8b..e5f45cb2a7a2 100644 --- a/drivers/net/wireless/p54/Kconfig +++ b/drivers/net/wireless/p54/Kconfig | |||
@@ -49,6 +49,23 @@ config P54_SPI | |||
49 | 49 | ||
50 | If you choose to build a module, it'll be called p54spi. | 50 | If you choose to build a module, it'll be called p54spi. |
51 | 51 | ||
52 | config P54_SPI_DEFAULT_EEPROM | ||
53 | bool "Include fallback EEPROM blob" | ||
54 | depends on P54_SPI | ||
55 | default n | ||
56 | ---help--- | ||
57 | Unlike the PCI or USB devices, the SPI variants don't have | ||
58 | a dedicated EEPROM chip to store all device specific values | ||
59 | for calibration, country and interface settings. | ||
60 | |||
61 | The driver will try to load the image "3826.eeprom", if the | ||
62 | file is put at the right place. (usually /lib/firmware.) | ||
63 | |||
64 | Only if this request fails, this option will provide a | ||
65 | backup set of generic values to get the device working. | ||
66 | |||
67 | Enabling this option adds about 4k to p54spi. | ||
68 | |||
52 | config P54_LEDS | 69 | config P54_LEDS |
53 | bool | 70 | bool |
54 | depends on P54_COMMON && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = P54_COMMON) | 71 | depends on P54_COMMON && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = P54_COMMON) |
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index 087bf0698a5a..156e57dbd2cf 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
@@ -32,11 +32,14 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | 33 | ||
34 | #include "p54spi.h" | 34 | #include "p54spi.h" |
35 | #include "p54spi_eeprom.h" | ||
36 | #include "p54.h" | 35 | #include "p54.h" |
37 | 36 | ||
38 | #include "lmac.h" | 37 | #include "lmac.h" |
39 | 38 | ||
39 | #ifdef CONFIG_P54_SPI_DEFAULT_EEPROM | ||
40 | #include "p54spi_eeprom.h" | ||
41 | #endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */ | ||
42 | |||
40 | MODULE_FIRMWARE("3826.arm"); | 43 | MODULE_FIRMWARE("3826.arm"); |
41 | MODULE_ALIAS("stlc45xx"); | 44 | MODULE_ALIAS("stlc45xx"); |
42 | 45 | ||
@@ -195,9 +198,11 @@ static int p54spi_request_eeprom(struct ieee80211_hw *dev) | |||
195 | 198 | ||
196 | ret = request_firmware(&eeprom, "3826.eeprom", &priv->spi->dev); | 199 | ret = request_firmware(&eeprom, "3826.eeprom", &priv->spi->dev); |
197 | if (ret < 0) { | 200 | if (ret < 0) { |
201 | #ifdef CONFIG_P54_SPI_DEFAULT_EEPROM | ||
198 | dev_info(&priv->spi->dev, "loading default eeprom...\n"); | 202 | dev_info(&priv->spi->dev, "loading default eeprom...\n"); |
199 | ret = p54_parse_eeprom(dev, (void *) p54spi_eeprom, | 203 | ret = p54_parse_eeprom(dev, (void *) p54spi_eeprom, |
200 | sizeof(p54spi_eeprom)); | 204 | sizeof(p54spi_eeprom)); |
205 | #endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */ | ||
201 | } else { | 206 | } else { |
202 | dev_info(&priv->spi->dev, "loading user eeprom...\n"); | 207 | dev_info(&priv->spi->dev, "loading user eeprom...\n"); |
203 | ret = p54_parse_eeprom(dev, (void *) eeprom->data, | 208 | ret = p54_parse_eeprom(dev, (void *) eeprom->data, |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index ad595958b7df..063248b35069 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -930,8 +930,8 @@ static int __devinit p54u_probe(struct usb_interface *intf, | |||
930 | #ifdef CONFIG_PM | 930 | #ifdef CONFIG_PM |
931 | /* ISL3887 needs a full reset on resume */ | 931 | /* ISL3887 needs a full reset on resume */ |
932 | udev->reset_resume = 1; | 932 | udev->reset_resume = 1; |
933 | #endif /* CONFIG_PM */ | ||
933 | err = p54u_device_reset(dev); | 934 | err = p54u_device_reset(dev); |
934 | #endif | ||
935 | 935 | ||
936 | priv->hw_type = P54U_3887; | 936 | priv->hw_type = P54U_3887; |
937 | dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); | 937 | dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); |
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 34447d1ad80d..8f67db487f57 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -275,15 +275,15 @@ static int p54_rssi_to_dbm(struct p54_common *priv, int rssi) | |||
275 | { | 275 | { |
276 | int band = priv->hw->conf.channel->band; | 276 | int band = priv->hw->conf.channel->band; |
277 | 277 | ||
278 | if (priv->rxhw != 5) | 278 | if (priv->rxhw != 5) { |
279 | return ((rssi * priv->rssical_db[band].mul) / 64 + | 279 | return ((rssi * priv->rssical_db[band].mul) / 64 + |
280 | priv->rssical_db[band].add) / 4; | 280 | priv->rssical_db[band].add) / 4; |
281 | else | 281 | } else { |
282 | /* | 282 | /* |
283 | * TODO: find the correct formula | 283 | * TODO: find the correct formula |
284 | */ | 284 | */ |
285 | return ((rssi * priv->rssical_db[band].mul) / 64 + | 285 | return rssi / 2 - 110; |
286 | priv->rssical_db[band].add) / 4; | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | /* | 289 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 8e3fbdf48889..103c71164f10 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1007,12 +1007,11 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1007 | /* | 1007 | /* |
1008 | * TX descriptor initialization | 1008 | * TX descriptor initialization |
1009 | */ | 1009 | */ |
1010 | static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1010 | static void rt2400pci_write_tx_desc(struct queue_entry *entry, |
1011 | struct sk_buff *skb, | ||
1012 | struct txentry_desc *txdesc) | 1011 | struct txentry_desc *txdesc) |
1013 | { | 1012 | { |
1014 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1013 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1015 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1014 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1016 | __le32 *txd = entry_priv->desc; | 1015 | __le32 *txd = entry_priv->desc; |
1017 | u32 word; | 1016 | u32 word; |
1018 | 1017 | ||
@@ -1096,7 +1095,7 @@ static void rt2400pci_write_beacon(struct queue_entry *entry, | |||
1096 | /* | 1095 | /* |
1097 | * Write the TX descriptor for the beacon. | 1096 | * Write the TX descriptor for the beacon. |
1098 | */ | 1097 | */ |
1099 | rt2400pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1098 | rt2400pci_write_tx_desc(entry, txdesc); |
1100 | 1099 | ||
1101 | /* | 1100 | /* |
1102 | * Dump beacon to userspace through debugfs. | 1101 | * Dump beacon to userspace through debugfs. |
@@ -1112,24 +1111,24 @@ static void rt2400pci_write_beacon(struct queue_entry *entry, | |||
1112 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1111 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1113 | } | 1112 | } |
1114 | 1113 | ||
1115 | static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1114 | static void rt2400pci_kick_tx_queue(struct data_queue *queue) |
1116 | const enum data_queue_qid queue) | ||
1117 | { | 1115 | { |
1116 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1118 | u32 reg; | 1117 | u32 reg; |
1119 | 1118 | ||
1120 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1119 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1121 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1120 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE)); |
1122 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1121 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK)); |
1123 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue == QID_ATIM)); | 1122 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM)); |
1124 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | 1123 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); |
1125 | } | 1124 | } |
1126 | 1125 | ||
1127 | static void rt2400pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 1126 | static void rt2400pci_kill_tx_queue(struct data_queue *queue) |
1128 | const enum data_queue_qid qid) | ||
1129 | { | 1127 | { |
1128 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1130 | u32 reg; | 1129 | u32 reg; |
1131 | 1130 | ||
1132 | if (qid == QID_BEACON) { | 1131 | if (queue->qid == QID_BEACON) { |
1133 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | 1132 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); |
1134 | } else { | 1133 | } else { |
1135 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1134 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
@@ -1488,8 +1487,10 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1488 | spec->channels_info = info; | 1487 | spec->channels_info = info; |
1489 | 1488 | ||
1490 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1489 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1491 | for (i = 0; i < 14; i++) | 1490 | for (i = 0; i < 14; i++) { |
1492 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1491 | info[i].max_power = TXPOWER_FROM_DEV(MAX_TXPOWER); |
1492 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1493 | } | ||
1493 | 1494 | ||
1494 | return 0; | 1495 | return 0; |
1495 | } | 1496 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 1d174e42f11e..ab0507110e42 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1161,12 +1161,11 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1161 | /* | 1161 | /* |
1162 | * TX descriptor initialization | 1162 | * TX descriptor initialization |
1163 | */ | 1163 | */ |
1164 | static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1164 | static void rt2500pci_write_tx_desc(struct queue_entry *entry, |
1165 | struct sk_buff *skb, | ||
1166 | struct txentry_desc *txdesc) | 1165 | struct txentry_desc *txdesc) |
1167 | { | 1166 | { |
1168 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1167 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1169 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1168 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1170 | __le32 *txd = entry_priv->desc; | 1169 | __le32 *txd = entry_priv->desc; |
1171 | u32 word; | 1170 | u32 word; |
1172 | 1171 | ||
@@ -1249,7 +1248,7 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1249 | /* | 1248 | /* |
1250 | * Write the TX descriptor for the beacon. | 1249 | * Write the TX descriptor for the beacon. |
1251 | */ | 1250 | */ |
1252 | rt2500pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1251 | rt2500pci_write_tx_desc(entry, txdesc); |
1253 | 1252 | ||
1254 | /* | 1253 | /* |
1255 | * Dump beacon to userspace through debugfs. | 1254 | * Dump beacon to userspace through debugfs. |
@@ -1265,24 +1264,24 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1265 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1264 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1266 | } | 1265 | } |
1267 | 1266 | ||
1268 | static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1267 | static void rt2500pci_kick_tx_queue(struct data_queue *queue) |
1269 | const enum data_queue_qid queue) | ||
1270 | { | 1268 | { |
1269 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1271 | u32 reg; | 1270 | u32 reg; |
1272 | 1271 | ||
1273 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1272 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1274 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1273 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE)); |
1275 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1274 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK)); |
1276 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue == QID_ATIM)); | 1275 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM)); |
1277 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | 1276 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); |
1278 | } | 1277 | } |
1279 | 1278 | ||
1280 | static void rt2500pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 1279 | static void rt2500pci_kill_tx_queue(struct data_queue *queue) |
1281 | const enum data_queue_qid qid) | ||
1282 | { | 1280 | { |
1281 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1283 | u32 reg; | 1282 | u32 reg; |
1284 | 1283 | ||
1285 | if (qid == QID_BEACON) { | 1284 | if (queue->qid == QID_BEACON) { |
1286 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | 1285 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); |
1287 | } else { | 1286 | } else { |
1288 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1287 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
@@ -1802,12 +1801,16 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1802 | spec->channels_info = info; | 1801 | spec->channels_info = info; |
1803 | 1802 | ||
1804 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1803 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1805 | for (i = 0; i < 14; i++) | 1804 | for (i = 0; i < 14; i++) { |
1806 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1805 | info[i].max_power = MAX_TXPOWER; |
1806 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1807 | } | ||
1807 | 1808 | ||
1808 | if (spec->num_channels > 14) { | 1809 | if (spec->num_channels > 14) { |
1809 | for (i = 14; i < spec->num_channels; i++) | 1810 | for (i = 14; i < spec->num_channels; i++) { |
1810 | info[i].tx_power1 = DEFAULT_TXPOWER; | 1811 | info[i].max_power = MAX_TXPOWER; |
1812 | info[i].default_power1 = DEFAULT_TXPOWER; | ||
1813 | } | ||
1811 | } | 1814 | } |
1812 | 1815 | ||
1813 | return 0; | 1816 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index baadf03a800e..db64df4267d8 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1041,12 +1041,11 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1041 | /* | 1041 | /* |
1042 | * TX descriptor initialization | 1042 | * TX descriptor initialization |
1043 | */ | 1043 | */ |
1044 | static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1044 | static void rt2500usb_write_tx_desc(struct queue_entry *entry, |
1045 | struct sk_buff *skb, | ||
1046 | struct txentry_desc *txdesc) | 1045 | struct txentry_desc *txdesc) |
1047 | { | 1046 | { |
1048 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1047 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1049 | __le32 *txd = (__le32 *) skb->data; | 1048 | __le32 *txd = (__le32 *) entry->skb->data; |
1050 | u32 word; | 1049 | u32 word; |
1051 | 1050 | ||
1052 | /* | 1051 | /* |
@@ -1129,7 +1128,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry, | |||
1129 | /* | 1128 | /* |
1130 | * Write the TX descriptor for the beacon. | 1129 | * Write the TX descriptor for the beacon. |
1131 | */ | 1130 | */ |
1132 | rt2500usb_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1131 | rt2500usb_write_tx_desc(entry, txdesc); |
1133 | 1132 | ||
1134 | /* | 1133 | /* |
1135 | * Dump beacon to userspace through debugfs. | 1134 | * Dump beacon to userspace through debugfs. |
@@ -1197,6 +1196,14 @@ static int rt2500usb_get_tx_data_len(struct queue_entry *entry) | |||
1197 | return length; | 1196 | return length; |
1198 | } | 1197 | } |
1199 | 1198 | ||
1199 | static void rt2500usb_kill_tx_queue(struct data_queue *queue) | ||
1200 | { | ||
1201 | if (queue->qid == QID_BEACON) | ||
1202 | rt2500usb_register_write(queue->rt2x00dev, TXRX_CSR19, 0); | ||
1203 | |||
1204 | rt2x00usb_kill_tx_queue(queue); | ||
1205 | } | ||
1206 | |||
1200 | /* | 1207 | /* |
1201 | * RX control handlers | 1208 | * RX control handlers |
1202 | */ | 1209 | */ |
@@ -1707,12 +1714,16 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1707 | spec->channels_info = info; | 1714 | spec->channels_info = info; |
1708 | 1715 | ||
1709 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1716 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1710 | for (i = 0; i < 14; i++) | 1717 | for (i = 0; i < 14; i++) { |
1711 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1718 | info[i].max_power = MAX_TXPOWER; |
1719 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1720 | } | ||
1712 | 1721 | ||
1713 | if (spec->num_channels > 14) { | 1722 | if (spec->num_channels > 14) { |
1714 | for (i = 14; i < spec->num_channels; i++) | 1723 | for (i = 14; i < spec->num_channels; i++) { |
1715 | info[i].tx_power1 = DEFAULT_TXPOWER; | 1724 | info[i].max_power = MAX_TXPOWER; |
1725 | info[i].default_power1 = DEFAULT_TXPOWER; | ||
1726 | } | ||
1716 | } | 1727 | } |
1717 | 1728 | ||
1718 | return 0; | 1729 | return 0; |
@@ -1791,7 +1802,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1791 | .write_beacon = rt2500usb_write_beacon, | 1802 | .write_beacon = rt2500usb_write_beacon, |
1792 | .get_tx_data_len = rt2500usb_get_tx_data_len, | 1803 | .get_tx_data_len = rt2500usb_get_tx_data_len, |
1793 | .kick_tx_queue = rt2x00usb_kick_tx_queue, | 1804 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
1794 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 1805 | .kill_tx_queue = rt2500usb_kill_tx_queue, |
1795 | .fill_rxdone = rt2500usb_fill_rxdone, | 1806 | .fill_rxdone = rt2500usb_fill_rxdone, |
1796 | .config_shared_key = rt2500usb_config_key, | 1807 | .config_shared_key = rt2500usb_config_key, |
1797 | .config_pairwise_key = rt2500usb_config_key, | 1808 | .config_pairwise_key = rt2500usb_config_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index cf1f16bfcd5e..70a5cb86405b 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -1859,6 +1859,13 @@ struct mac_iveiv_entry { | |||
1859 | #define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) | 1859 | #define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) |
1860 | 1860 | ||
1861 | /* | 1861 | /* |
1862 | * EEPROM Maximum TX power values | ||
1863 | */ | ||
1864 | #define EEPROM_MAX_TX_POWER 0x0027 | ||
1865 | #define EEPROM_MAX_TX_POWER_24GHZ FIELD16(0x00ff) | ||
1866 | #define EEPROM_MAX_TX_POWER_5GHZ FIELD16(0xff00) | ||
1867 | |||
1868 | /* | ||
1862 | * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. | 1869 | * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. |
1863 | * This is delta in 40MHZ. | 1870 | * This is delta in 40MHZ. |
1864 | * VALUE: Tx Power dalta value (MAX=4) | 1871 | * VALUE: Tx Power dalta value (MAX=4) |
@@ -1946,6 +1953,8 @@ struct mac_iveiv_entry { | |||
1946 | * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs | 1953 | * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs |
1947 | * BW: Channel bandwidth 20MHz or 40 MHz | 1954 | * BW: Channel bandwidth 20MHz or 40 MHz |
1948 | * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED | 1955 | * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED |
1956 | * AMPDU: 1: this frame is eligible for AMPDU aggregation, the hw will | ||
1957 | * aggregate consecutive frames with the same RA and QoS TID. | ||
1949 | */ | 1958 | */ |
1950 | #define TXWI_W0_FRAG FIELD32(0x00000001) | 1959 | #define TXWI_W0_FRAG FIELD32(0x00000001) |
1951 | #define TXWI_W0_MIMO_PS FIELD32(0x00000002) | 1960 | #define TXWI_W0_MIMO_PS FIELD32(0x00000002) |
@@ -1969,7 +1978,9 @@ struct mac_iveiv_entry { | |||
1969 | * WIRELESS_CLI_ID: Client ID for WCID table access | 1978 | * WIRELESS_CLI_ID: Client ID for WCID table access |
1970 | * MPDU_TOTAL_BYTE_COUNT: Length of 802.11 frame | 1979 | * MPDU_TOTAL_BYTE_COUNT: Length of 802.11 frame |
1971 | * PACKETID: Will be latched into the TX_STA_FIFO register once the according | 1980 | * PACKETID: Will be latched into the TX_STA_FIFO register once the according |
1972 | * frame was processed. 0: Don't report tx status for this frame. | 1981 | * frame was processed. If multiple frames are aggregated together |
1982 | * (AMPDU==1) the reported tx status will always contain the packet | ||
1983 | * id of the first frame. 0: Don't report tx status for this frame. | ||
1973 | */ | 1984 | */ |
1974 | #define TXWI_W1_ACK FIELD32(0x00000001) | 1985 | #define TXWI_W1_ACK FIELD32(0x00000001) |
1975 | #define TXWI_W1_NSEQ FIELD32(0x00000002) | 1986 | #define TXWI_W1_NSEQ FIELD32(0x00000002) |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 6a0cb2d924d8..27a6e225083c 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -255,6 +255,23 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | |||
255 | } | 255 | } |
256 | EXPORT_SYMBOL_GPL(rt2800_mcu_request); | 256 | EXPORT_SYMBOL_GPL(rt2800_mcu_request); |
257 | 257 | ||
258 | int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev) | ||
259 | { | ||
260 | unsigned int i = 0; | ||
261 | u32 reg; | ||
262 | |||
263 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | ||
264 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | ||
265 | if (reg && reg != ~0) | ||
266 | return 0; | ||
267 | msleep(1); | ||
268 | } | ||
269 | |||
270 | ERROR(rt2x00dev, "Unstable hardware.\n"); | ||
271 | return -EBUSY; | ||
272 | } | ||
273 | EXPORT_SYMBOL_GPL(rt2800_wait_csr_ready); | ||
274 | |||
258 | int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) | 275 | int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) |
259 | { | 276 | { |
260 | unsigned int i; | 277 | unsigned int i; |
@@ -368,19 +385,16 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, | |||
368 | u32 reg; | 385 | u32 reg; |
369 | 386 | ||
370 | /* | 387 | /* |
371 | * Wait for stable hardware. | 388 | * If driver doesn't wake up firmware here, |
389 | * rt2800_load_firmware will hang forever when interface is up again. | ||
372 | */ | 390 | */ |
373 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 391 | rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0x00000000); |
374 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | ||
375 | if (reg && reg != ~0) | ||
376 | break; | ||
377 | msleep(1); | ||
378 | } | ||
379 | 392 | ||
380 | if (i == REGISTER_BUSY_COUNT) { | 393 | /* |
381 | ERROR(rt2x00dev, "Unstable hardware.\n"); | 394 | * Wait for stable hardware. |
395 | */ | ||
396 | if (rt2800_wait_csr_ready(rt2x00dev)) | ||
382 | return -EBUSY; | 397 | return -EBUSY; |
383 | } | ||
384 | 398 | ||
385 | if (rt2x00_is_pci(rt2x00dev)) | 399 | if (rt2x00_is_pci(rt2x00dev)) |
386 | rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002); | 400 | rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002); |
@@ -469,7 +483,7 @@ void rt2800_write_tx_data(struct queue_entry *entry, | |||
469 | txdesc->key_idx : 0xff); | 483 | txdesc->key_idx : 0xff); |
470 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | 484 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, |
471 | txdesc->length); | 485 | txdesc->length); |
472 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, txdesc->queue + 1); | 486 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, txdesc->qid + 1); |
473 | rt2x00_desc_write(txwi, 1, word); | 487 | rt2x00_desc_write(txwi, 1, word); |
474 | 488 | ||
475 | /* | 489 | /* |
@@ -573,6 +587,49 @@ void rt2800_process_rxwi(struct queue_entry *entry, | |||
573 | } | 587 | } |
574 | EXPORT_SYMBOL_GPL(rt2800_process_rxwi); | 588 | EXPORT_SYMBOL_GPL(rt2800_process_rxwi); |
575 | 589 | ||
590 | static bool rt2800_txdone_entry_check(struct queue_entry *entry, u32 reg) | ||
591 | { | ||
592 | __le32 *txwi; | ||
593 | u32 word; | ||
594 | int wcid, ack, pid; | ||
595 | int tx_wcid, tx_ack, tx_pid; | ||
596 | |||
597 | wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); | ||
598 | ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); | ||
599 | pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); | ||
600 | |||
601 | /* | ||
602 | * This frames has returned with an IO error, | ||
603 | * so the status report is not intended for this | ||
604 | * frame. | ||
605 | */ | ||
606 | if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) { | ||
607 | rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); | ||
608 | return false; | ||
609 | } | ||
610 | |||
611 | /* | ||
612 | * Validate if this TX status report is intended for | ||
613 | * this entry by comparing the WCID/ACK/PID fields. | ||
614 | */ | ||
615 | txwi = rt2800_drv_get_txwi(entry); | ||
616 | |||
617 | rt2x00_desc_read(txwi, 1, &word); | ||
618 | tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); | ||
619 | tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK); | ||
620 | tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID); | ||
621 | |||
622 | if ((wcid != tx_wcid) || (ack != tx_ack) || (pid != tx_pid)) { | ||
623 | WARNING(entry->queue->rt2x00dev, | ||
624 | "TX status report missed for queue %d entry %d\n", | ||
625 | entry->queue->qid, entry->entry_idx); | ||
626 | rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN); | ||
627 | return false; | ||
628 | } | ||
629 | |||
630 | return true; | ||
631 | } | ||
632 | |||
576 | void rt2800_txdone(struct rt2x00_dev *rt2x00dev) | 633 | void rt2800_txdone(struct rt2x00_dev *rt2x00dev) |
577 | { | 634 | { |
578 | struct data_queue *queue; | 635 | struct data_queue *queue; |
@@ -581,8 +638,8 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev) | |||
581 | struct txdone_entry_desc txdesc; | 638 | struct txdone_entry_desc txdesc; |
582 | u32 word; | 639 | u32 word; |
583 | u32 reg; | 640 | u32 reg; |
584 | int wcid, ack, pid, tx_wcid, tx_ack, tx_pid; | ||
585 | u16 mcs, real_mcs; | 641 | u16 mcs, real_mcs; |
642 | u8 pid; | ||
586 | int i; | 643 | int i; |
587 | 644 | ||
588 | /* | 645 | /* |
@@ -599,18 +656,15 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev) | |||
599 | if (!rt2x00_get_field32(reg, TX_STA_FIFO_VALID)) | 656 | if (!rt2x00_get_field32(reg, TX_STA_FIFO_VALID)) |
600 | break; | 657 | break; |
601 | 658 | ||
602 | wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); | ||
603 | ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); | ||
604 | pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); | ||
605 | |||
606 | /* | 659 | /* |
607 | * Skip this entry when it contains an invalid | 660 | * Skip this entry when it contains an invalid |
608 | * queue identication number. | 661 | * queue identication number. |
609 | */ | 662 | */ |
610 | if (pid <= 0 || pid > QID_RX) | 663 | pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE) - 1; |
664 | if (pid >= QID_RX) | ||
611 | continue; | 665 | continue; |
612 | 666 | ||
613 | queue = rt2x00queue_get_queue(rt2x00dev, pid - 1); | 667 | queue = rt2x00queue_get_queue(rt2x00dev, pid); |
614 | if (unlikely(!queue)) | 668 | if (unlikely(!queue)) |
615 | continue; | 669 | continue; |
616 | 670 | ||
@@ -619,38 +673,24 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev) | |||
619 | * order. We first check that the queue is not empty. | 673 | * order. We first check that the queue is not empty. |
620 | */ | 674 | */ |
621 | entry = NULL; | 675 | entry = NULL; |
676 | txwi = NULL; | ||
622 | while (!rt2x00queue_empty(queue)) { | 677 | while (!rt2x00queue_empty(queue)) { |
623 | entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); | 678 | entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); |
624 | if (!test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) | 679 | if (rt2800_txdone_entry_check(entry, reg)) |
625 | break; | 680 | break; |
626 | |||
627 | rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); | ||
628 | } | 681 | } |
629 | 682 | ||
630 | if (!entry || rt2x00queue_empty(queue)) | 683 | if (!entry || rt2x00queue_empty(queue)) |
631 | break; | 684 | break; |
632 | 685 | ||
633 | /* | ||
634 | * Check if we got a match by looking at WCID/ACK/PID | ||
635 | * fields | ||
636 | */ | ||
637 | txwi = rt2800_drv_get_txwi(entry); | ||
638 | |||
639 | rt2x00_desc_read(txwi, 1, &word); | ||
640 | tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); | ||
641 | tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK); | ||
642 | tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID); | ||
643 | |||
644 | if ((wcid != tx_wcid) || (ack != tx_ack) || (pid != tx_pid)) | ||
645 | WARNING(rt2x00dev, "invalid TX_STA_FIFO content"); | ||
646 | 686 | ||
647 | /* | 687 | /* |
648 | * Obtain the status about this packet. | 688 | * Obtain the status about this packet. |
649 | */ | 689 | */ |
650 | txdesc.flags = 0; | 690 | txdesc.flags = 0; |
691 | txwi = rt2800_drv_get_txwi(entry); | ||
651 | rt2x00_desc_read(txwi, 0, &word); | 692 | rt2x00_desc_read(txwi, 0, &word); |
652 | mcs = rt2x00_get_field32(word, TXWI_W0_MCS); | 693 | mcs = rt2x00_get_field32(word, TXWI_W0_MCS); |
653 | mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS); | ||
654 | real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS); | 694 | real_mcs = rt2x00_get_field32(reg, TX_STA_FIFO_MCS); |
655 | 695 | ||
656 | /* | 696 | /* |
@@ -1095,19 +1135,23 @@ void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, | |||
1095 | } | 1135 | } |
1096 | 1136 | ||
1097 | if (flags & CONFIG_UPDATE_MAC) { | 1137 | if (flags & CONFIG_UPDATE_MAC) { |
1098 | reg = le32_to_cpu(conf->mac[1]); | 1138 | if (!is_zero_ether_addr((const u8 *)conf->mac)) { |
1099 | rt2x00_set_field32(®, MAC_ADDR_DW1_UNICAST_TO_ME_MASK, 0xff); | 1139 | reg = le32_to_cpu(conf->mac[1]); |
1100 | conf->mac[1] = cpu_to_le32(reg); | 1140 | rt2x00_set_field32(®, MAC_ADDR_DW1_UNICAST_TO_ME_MASK, 0xff); |
1141 | conf->mac[1] = cpu_to_le32(reg); | ||
1142 | } | ||
1101 | 1143 | ||
1102 | rt2800_register_multiwrite(rt2x00dev, MAC_ADDR_DW0, | 1144 | rt2800_register_multiwrite(rt2x00dev, MAC_ADDR_DW0, |
1103 | conf->mac, sizeof(conf->mac)); | 1145 | conf->mac, sizeof(conf->mac)); |
1104 | } | 1146 | } |
1105 | 1147 | ||
1106 | if (flags & CONFIG_UPDATE_BSSID) { | 1148 | if (flags & CONFIG_UPDATE_BSSID) { |
1107 | reg = le32_to_cpu(conf->bssid[1]); | 1149 | if (!is_zero_ether_addr((const u8 *)conf->bssid)) { |
1108 | rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3); | 1150 | reg = le32_to_cpu(conf->bssid[1]); |
1109 | rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7); | 1151 | rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3); |
1110 | conf->bssid[1] = cpu_to_le32(reg); | 1152 | rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7); |
1153 | conf->bssid[1] = cpu_to_le32(reg); | ||
1154 | } | ||
1111 | 1155 | ||
1112 | rt2800_register_multiwrite(rt2x00dev, MAC_BSSID_DW0, | 1156 | rt2800_register_multiwrite(rt2x00dev, MAC_BSSID_DW0, |
1113 | conf->bssid, sizeof(conf->bssid)); | 1157 | conf->bssid, sizeof(conf->bssid)); |
@@ -1240,27 +1284,23 @@ static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev, | |||
1240 | * double meaning, and we should set a 7DBm boost flag. | 1284 | * double meaning, and we should set a 7DBm boost flag. |
1241 | */ | 1285 | */ |
1242 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, | 1286 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, |
1243 | (info->tx_power1 >= 0)); | 1287 | (info->default_power1 >= 0)); |
1244 | 1288 | ||
1245 | if (info->tx_power1 < 0) | 1289 | if (info->default_power1 < 0) |
1246 | info->tx_power1 += 7; | 1290 | info->default_power1 += 7; |
1247 | 1291 | ||
1248 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, | 1292 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, info->default_power1); |
1249 | TXPOWER_A_TO_DEV(info->tx_power1)); | ||
1250 | 1293 | ||
1251 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, | 1294 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, |
1252 | (info->tx_power2 >= 0)); | 1295 | (info->default_power2 >= 0)); |
1253 | 1296 | ||
1254 | if (info->tx_power2 < 0) | 1297 | if (info->default_power2 < 0) |
1255 | info->tx_power2 += 7; | 1298 | info->default_power2 += 7; |
1256 | 1299 | ||
1257 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, | 1300 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, info->default_power2); |
1258 | TXPOWER_A_TO_DEV(info->tx_power2)); | ||
1259 | } else { | 1301 | } else { |
1260 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, | 1302 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, info->default_power1); |
1261 | TXPOWER_G_TO_DEV(info->tx_power1)); | 1303 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, info->default_power2); |
1262 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, | ||
1263 | TXPOWER_G_TO_DEV(info->tx_power2)); | ||
1264 | } | 1304 | } |
1265 | 1305 | ||
1266 | rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); | 1306 | rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); |
@@ -1300,13 +1340,11 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev, | |||
1300 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); | 1340 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); |
1301 | 1341 | ||
1302 | rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); | 1342 | rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); |
1303 | rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, | 1343 | rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, info->default_power1); |
1304 | TXPOWER_G_TO_DEV(info->tx_power1)); | ||
1305 | rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); | 1344 | rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); |
1306 | 1345 | ||
1307 | rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); | 1346 | rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); |
1308 | rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, | 1347 | rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2); |
1309 | TXPOWER_G_TO_DEV(info->tx_power2)); | ||
1310 | rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); | 1348 | rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); |
1311 | 1349 | ||
1312 | rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); | 1350 | rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); |
@@ -1330,10 +1368,19 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
1330 | unsigned int tx_pin; | 1368 | unsigned int tx_pin; |
1331 | u8 bbp; | 1369 | u8 bbp; |
1332 | 1370 | ||
1371 | if (rf->channel <= 14) { | ||
1372 | info->default_power1 = TXPOWER_G_TO_DEV(info->default_power1); | ||
1373 | info->default_power2 = TXPOWER_G_TO_DEV(info->default_power2); | ||
1374 | } else { | ||
1375 | info->default_power1 = TXPOWER_A_TO_DEV(info->default_power1); | ||
1376 | info->default_power2 = TXPOWER_A_TO_DEV(info->default_power2); | ||
1377 | } | ||
1378 | |||
1333 | if (rt2x00_rf(rt2x00dev, RF2020) || | 1379 | if (rt2x00_rf(rt2x00dev, RF2020) || |
1334 | rt2x00_rf(rt2x00dev, RF3020) || | 1380 | rt2x00_rf(rt2x00dev, RF3020) || |
1335 | rt2x00_rf(rt2x00dev, RF3021) || | 1381 | rt2x00_rf(rt2x00dev, RF3021) || |
1336 | rt2x00_rf(rt2x00dev, RF3022)) | 1382 | rt2x00_rf(rt2x00dev, RF3022) || |
1383 | rt2x00_rf(rt2x00dev, RF3052)) | ||
1337 | rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info); | 1384 | rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info); |
1338 | else | 1385 | else |
1339 | rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); | 1386 | rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); |
@@ -1656,7 +1703,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner); | |||
1656 | /* | 1703 | /* |
1657 | * Initialization functions. | 1704 | * Initialization functions. |
1658 | */ | 1705 | */ |
1659 | int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | 1706 | static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) |
1660 | { | 1707 | { |
1661 | u32 reg; | 1708 | u32 reg; |
1662 | u16 eeprom; | 1709 | u16 eeprom; |
@@ -2026,7 +2073,6 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
2026 | 2073 | ||
2027 | return 0; | 2074 | return 0; |
2028 | } | 2075 | } |
2029 | EXPORT_SYMBOL_GPL(rt2800_init_registers); | ||
2030 | 2076 | ||
2031 | static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev) | 2077 | static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev) |
2032 | { | 2078 | { |
@@ -2069,7 +2115,7 @@ static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) | |||
2069 | return -EACCES; | 2115 | return -EACCES; |
2070 | } | 2116 | } |
2071 | 2117 | ||
2072 | int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | 2118 | static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) |
2073 | { | 2119 | { |
2074 | unsigned int i; | 2120 | unsigned int i; |
2075 | u16 eeprom; | 2121 | u16 eeprom; |
@@ -2164,7 +2210,6 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) | |||
2164 | 2210 | ||
2165 | return 0; | 2211 | return 0; |
2166 | } | 2212 | } |
2167 | EXPORT_SYMBOL_GPL(rt2800_init_bbp); | ||
2168 | 2213 | ||
2169 | static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, | 2214 | static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, |
2170 | bool bw40, u8 rfcsr24, u8 filter_target) | 2215 | bool bw40, u8 rfcsr24, u8 filter_target) |
@@ -2226,7 +2271,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, | |||
2226 | return rfcsr24; | 2271 | return rfcsr24; |
2227 | } | 2272 | } |
2228 | 2273 | ||
2229 | int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | 2274 | static int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) |
2230 | { | 2275 | { |
2231 | u8 rfcsr; | 2276 | u8 rfcsr; |
2232 | u8 bbp; | 2277 | u8 bbp; |
@@ -2480,7 +2525,100 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) | |||
2480 | 2525 | ||
2481 | return 0; | 2526 | return 0; |
2482 | } | 2527 | } |
2483 | EXPORT_SYMBOL_GPL(rt2800_init_rfcsr); | 2528 | |
2529 | int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) | ||
2530 | { | ||
2531 | u32 reg; | ||
2532 | u16 word; | ||
2533 | |||
2534 | /* | ||
2535 | * Initialize all registers. | ||
2536 | */ | ||
2537 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || | ||
2538 | rt2800_init_registers(rt2x00dev) || | ||
2539 | rt2800_init_bbp(rt2x00dev) || | ||
2540 | rt2800_init_rfcsr(rt2x00dev))) | ||
2541 | return -EIO; | ||
2542 | |||
2543 | /* | ||
2544 | * Send signal to firmware during boot time. | ||
2545 | */ | ||
2546 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); | ||
2547 | |||
2548 | if (rt2x00_is_usb(rt2x00dev) && | ||
2549 | (rt2x00_rt(rt2x00dev, RT3070) || | ||
2550 | rt2x00_rt(rt2x00dev, RT3071) || | ||
2551 | rt2x00_rt(rt2x00dev, RT3572))) { | ||
2552 | udelay(200); | ||
2553 | rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); | ||
2554 | udelay(10); | ||
2555 | } | ||
2556 | |||
2557 | /* | ||
2558 | * Enable RX. | ||
2559 | */ | ||
2560 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
2561 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); | ||
2562 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); | ||
2563 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
2564 | |||
2565 | udelay(50); | ||
2566 | |||
2567 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | ||
2568 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1); | ||
2569 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1); | ||
2570 | rt2x00_set_field32(®, WPDMA_GLO_CFG_WP_DMA_BURST_SIZE, 2); | ||
2571 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); | ||
2572 | rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); | ||
2573 | |||
2574 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
2575 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); | ||
2576 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); | ||
2577 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
2578 | |||
2579 | /* | ||
2580 | * Initialize LED control | ||
2581 | */ | ||
2582 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word); | ||
2583 | rt2800_mcu_request(rt2x00dev, MCU_LED_1, 0xff, | ||
2584 | word & 0xff, (word >> 8) & 0xff); | ||
2585 | |||
2586 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED2, &word); | ||
2587 | rt2800_mcu_request(rt2x00dev, MCU_LED_2, 0xff, | ||
2588 | word & 0xff, (word >> 8) & 0xff); | ||
2589 | |||
2590 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED3, &word); | ||
2591 | rt2800_mcu_request(rt2x00dev, MCU_LED_3, 0xff, | ||
2592 | word & 0xff, (word >> 8) & 0xff); | ||
2593 | |||
2594 | return 0; | ||
2595 | } | ||
2596 | EXPORT_SYMBOL_GPL(rt2800_enable_radio); | ||
2597 | |||
2598 | void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev) | ||
2599 | { | ||
2600 | u32 reg; | ||
2601 | |||
2602 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | ||
2603 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); | ||
2604 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0); | ||
2605 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); | ||
2606 | rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0); | ||
2607 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); | ||
2608 | rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); | ||
2609 | |||
2610 | /* Wait for DMA, ignore error */ | ||
2611 | rt2800_wait_wpdma_ready(rt2x00dev); | ||
2612 | |||
2613 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
2614 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 0); | ||
2615 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); | ||
2616 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
2617 | |||
2618 | rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0); | ||
2619 | rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0); | ||
2620 | } | ||
2621 | EXPORT_SYMBOL_GPL(rt2800_disable_radio); | ||
2484 | 2622 | ||
2485 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev) | 2623 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev) |
2486 | { | 2624 | { |
@@ -2636,6 +2774,13 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2636 | default_lna_gain); | 2774 | default_lna_gain); |
2637 | rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); | 2775 | rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); |
2638 | 2776 | ||
2777 | rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &word); | ||
2778 | if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_24GHZ) == 0xff) | ||
2779 | rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_24GHZ, MAX_G_TXPOWER); | ||
2780 | if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_5GHZ) == 0xff) | ||
2781 | rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_5GHZ, MAX_A_TXPOWER); | ||
2782 | rt2x00_eeprom_write(rt2x00dev, EEPROM_MAX_TX_POWER, word); | ||
2783 | |||
2639 | return 0; | 2784 | return 0; |
2640 | } | 2785 | } |
2641 | EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); | 2786 | EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); |
@@ -2875,9 +3020,10 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2875 | { | 3020 | { |
2876 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 3021 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
2877 | struct channel_info *info; | 3022 | struct channel_info *info; |
2878 | char *tx_power1; | 3023 | char *default_power1; |
2879 | char *tx_power2; | 3024 | char *default_power2; |
2880 | unsigned int i; | 3025 | unsigned int i; |
3026 | unsigned short max_power; | ||
2881 | u16 eeprom; | 3027 | u16 eeprom; |
2882 | 3028 | ||
2883 | /* | 3029 | /* |
@@ -2991,21 +3137,26 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2991 | 3137 | ||
2992 | spec->channels_info = info; | 3138 | spec->channels_info = info; |
2993 | 3139 | ||
2994 | tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); | 3140 | rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &eeprom); |
2995 | tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); | 3141 | max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_24GHZ); |
3142 | default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); | ||
3143 | default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); | ||
2996 | 3144 | ||
2997 | for (i = 0; i < 14; i++) { | 3145 | for (i = 0; i < 14; i++) { |
2998 | info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]); | 3146 | info[i].max_power = max_power; |
2999 | info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]); | 3147 | info[i].default_power1 = TXPOWER_G_FROM_DEV(default_power1[i]); |
3148 | info[i].default_power2 = TXPOWER_G_FROM_DEV(default_power2[i]); | ||
3000 | } | 3149 | } |
3001 | 3150 | ||
3002 | if (spec->num_channels > 14) { | 3151 | if (spec->num_channels > 14) { |
3003 | tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); | 3152 | max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_5GHZ); |
3004 | tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); | 3153 | default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); |
3154 | default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); | ||
3005 | 3155 | ||
3006 | for (i = 14; i < spec->num_channels; i++) { | 3156 | for (i = 14; i < spec->num_channels; i++) { |
3007 | info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]); | 3157 | info[i].max_power = max_power; |
3008 | info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]); | 3158 | info[i].default_power1 = TXPOWER_A_FROM_DEV(default_power1[i]); |
3159 | info[i].default_power2 = TXPOWER_A_FROM_DEV(default_power2[i]); | ||
3009 | } | 3160 | } |
3010 | } | 3161 | } |
3011 | 3162 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index 3b572c63382d..986229c06c19 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -140,6 +140,9 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, | |||
140 | const u8 command, const u8 token, | 140 | const u8 command, const u8 token, |
141 | const u8 arg0, const u8 arg1); | 141 | const u8 arg0, const u8 arg1); |
142 | 142 | ||
143 | int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev); | ||
144 | int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev); | ||
145 | |||
143 | int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, | 146 | int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, |
144 | const u8 *data, const size_t len); | 147 | const u8 *data, const size_t len); |
145 | int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, | 148 | int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, |
@@ -176,10 +179,8 @@ void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); | |||
176 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, | 179 | void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, |
177 | const u32 count); | 180 | const u32 count); |
178 | 181 | ||
179 | int rt2800_init_registers(struct rt2x00_dev *rt2x00dev); | 182 | int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); |
180 | int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev); | 183 | void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); |
181 | int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev); | ||
182 | int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev); | ||
183 | 184 | ||
184 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev); | 185 | int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev); |
185 | void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev); | 186 | void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 4390f2b74b2e..2bcb1507e3ac 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -196,8 +196,6 @@ static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
196 | { | 196 | { |
197 | u32 reg; | 197 | u32 reg; |
198 | 198 | ||
199 | rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0x00000000); | ||
200 | |||
201 | /* | 199 | /* |
202 | * enable Host program ram write selection | 200 | * enable Host program ram write selection |
203 | */ | 201 | */ |
@@ -399,78 +397,18 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev) | |||
399 | 397 | ||
400 | static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) | 398 | static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) |
401 | { | 399 | { |
402 | u32 reg; | ||
403 | u16 word; | ||
404 | |||
405 | /* | ||
406 | * Initialize all registers. | ||
407 | */ | ||
408 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || | 400 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || |
409 | rt2800pci_init_queues(rt2x00dev) || | 401 | rt2800pci_init_queues(rt2x00dev))) |
410 | rt2800_init_registers(rt2x00dev) || | ||
411 | rt2800_wait_wpdma_ready(rt2x00dev) || | ||
412 | rt2800_init_bbp(rt2x00dev) || | ||
413 | rt2800_init_rfcsr(rt2x00dev))) | ||
414 | return -EIO; | 402 | return -EIO; |
415 | 403 | ||
416 | /* | 404 | return rt2800_enable_radio(rt2x00dev); |
417 | * Send signal to firmware during boot time. | ||
418 | */ | ||
419 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); | ||
420 | |||
421 | /* | ||
422 | * Enable RX. | ||
423 | */ | ||
424 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
425 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); | ||
426 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); | ||
427 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
428 | |||
429 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | ||
430 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1); | ||
431 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1); | ||
432 | rt2x00_set_field32(®, WPDMA_GLO_CFG_WP_DMA_BURST_SIZE, 2); | ||
433 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); | ||
434 | rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); | ||
435 | |||
436 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
437 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); | ||
438 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); | ||
439 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
440 | |||
441 | /* | ||
442 | * Initialize LED control | ||
443 | */ | ||
444 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word); | ||
445 | rt2800_mcu_request(rt2x00dev, MCU_LED_1, 0xff, | ||
446 | word & 0xff, (word >> 8) & 0xff); | ||
447 | |||
448 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED2, &word); | ||
449 | rt2800_mcu_request(rt2x00dev, MCU_LED_2, 0xff, | ||
450 | word & 0xff, (word >> 8) & 0xff); | ||
451 | |||
452 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED3, &word); | ||
453 | rt2800_mcu_request(rt2x00dev, MCU_LED_3, 0xff, | ||
454 | word & 0xff, (word >> 8) & 0xff); | ||
455 | |||
456 | return 0; | ||
457 | } | 405 | } |
458 | 406 | ||
459 | static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) | 407 | static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) |
460 | { | 408 | { |
461 | u32 reg; | 409 | u32 reg; |
462 | 410 | ||
463 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | 411 | rt2800_disable_radio(rt2x00dev); |
464 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); | ||
465 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0); | ||
466 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); | ||
467 | rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0); | ||
468 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); | ||
469 | rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); | ||
470 | |||
471 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0); | ||
472 | rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0); | ||
473 | rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0); | ||
474 | 412 | ||
475 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001280); | 413 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001280); |
476 | 414 | ||
@@ -486,9 +424,6 @@ static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
486 | 424 | ||
487 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); | 425 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); |
488 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); | 426 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); |
489 | |||
490 | /* Wait for DMA, ignore error */ | ||
491 | rt2800_wait_wpdma_ready(rt2x00dev); | ||
492 | } | 427 | } |
493 | 428 | ||
494 | static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, | 429 | static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, |
@@ -571,12 +506,11 @@ static __le32 *rt2800pci_get_txwi(struct queue_entry *entry) | |||
571 | return (__le32 *) entry->skb->data; | 506 | return (__le32 *) entry->skb->data; |
572 | } | 507 | } |
573 | 508 | ||
574 | static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 509 | static void rt2800pci_write_tx_desc(struct queue_entry *entry, |
575 | struct sk_buff *skb, | ||
576 | struct txentry_desc *txdesc) | 510 | struct txentry_desc *txdesc) |
577 | { | 511 | { |
578 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 512 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
579 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 513 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
580 | __le32 *txd = entry_priv->desc; | 514 | __le32 *txd = entry_priv->desc; |
581 | u32 word; | 515 | u32 word; |
582 | 516 | ||
@@ -596,7 +530,7 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
596 | rt2x00_desc_write(txd, 0, word); | 530 | rt2x00_desc_write(txd, 0, word); |
597 | 531 | ||
598 | rt2x00_desc_read(txd, 1, &word); | 532 | rt2x00_desc_read(txd, 1, &word); |
599 | rt2x00_set_field32(&word, TXD_W1_SD_LEN1, skb->len); | 533 | rt2x00_set_field32(&word, TXD_W1_SD_LEN1, entry->skb->len); |
600 | rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, | 534 | rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, |
601 | !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | 535 | !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); |
602 | rt2x00_set_field32(&word, TXD_W1_BURST, | 536 | rt2x00_set_field32(&word, TXD_W1_BURST, |
@@ -627,41 +561,35 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
627 | /* | 561 | /* |
628 | * TX data initialization | 562 | * TX data initialization |
629 | */ | 563 | */ |
630 | static void rt2800pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 564 | static void rt2800pci_kick_tx_queue(struct data_queue *queue) |
631 | const enum data_queue_qid queue_idx) | ||
632 | { | 565 | { |
633 | struct data_queue *queue; | 566 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; |
634 | unsigned int idx, qidx = 0; | 567 | struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); |
635 | 568 | unsigned int qidx = 0; | |
636 | if (queue_idx > QID_HCCA && queue_idx != QID_MGMT) | ||
637 | return; | ||
638 | |||
639 | queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); | ||
640 | idx = queue->index[Q_INDEX]; | ||
641 | 569 | ||
642 | if (queue_idx == QID_MGMT) | 570 | if (queue->qid == QID_MGMT) |
643 | qidx = 5; | 571 | qidx = 5; |
644 | else | 572 | else |
645 | qidx = queue_idx; | 573 | qidx = queue->qid; |
646 | 574 | ||
647 | rt2800_register_write(rt2x00dev, TX_CTX_IDX(qidx), idx); | 575 | rt2800_register_write(rt2x00dev, TX_CTX_IDX(qidx), entry->entry_idx); |
648 | } | 576 | } |
649 | 577 | ||
650 | static void rt2800pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 578 | static void rt2800pci_kill_tx_queue(struct data_queue *queue) |
651 | const enum data_queue_qid qid) | ||
652 | { | 579 | { |
580 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
653 | u32 reg; | 581 | u32 reg; |
654 | 582 | ||
655 | if (qid == QID_BEACON) { | 583 | if (queue->qid == QID_BEACON) { |
656 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, 0); | 584 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, 0); |
657 | return; | 585 | return; |
658 | } | 586 | } |
659 | 587 | ||
660 | rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, ®); | 588 | rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, ®); |
661 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, (qid == QID_AC_BE)); | 589 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, (queue->qid == QID_AC_BE)); |
662 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, (qid == QID_AC_BK)); | 590 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, (queue->qid == QID_AC_BK)); |
663 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, (qid == QID_AC_VI)); | 591 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, (queue->qid == QID_AC_VI)); |
664 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, (qid == QID_AC_VO)); | 592 | rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, (queue->qid == QID_AC_VO)); |
665 | rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg); | 593 | rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg); |
666 | } | 594 | } |
667 | 595 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 9ad28be294eb..3dff56ec195a 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -101,19 +101,6 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
101 | msleep(10); | 101 | msleep(10); |
102 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); | 102 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); |
103 | 103 | ||
104 | /* | ||
105 | * Send signal to firmware during boot time. | ||
106 | */ | ||
107 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); | ||
108 | |||
109 | if (rt2x00_rt(rt2x00dev, RT3070) || | ||
110 | rt2x00_rt(rt2x00dev, RT3071) || | ||
111 | rt2x00_rt(rt2x00dev, RT3572)) { | ||
112 | udelay(200); | ||
113 | rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); | ||
114 | udelay(10); | ||
115 | } | ||
116 | |||
117 | return 0; | 104 | return 0; |
118 | } | 105 | } |
119 | 106 | ||
@@ -135,26 +122,18 @@ static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev, | |||
135 | static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) | 122 | static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) |
136 | { | 123 | { |
137 | u32 reg; | 124 | u32 reg; |
138 | int i; | ||
139 | 125 | ||
140 | /* | 126 | /* |
141 | * Wait until BBP and RF are ready. | 127 | * Wait until BBP and RF are ready. |
142 | */ | 128 | */ |
143 | for (i = 0; i < REGISTER_BUSY_COUNT; i++) { | 129 | if (rt2800_wait_csr_ready(rt2x00dev)) |
144 | rt2800_register_read(rt2x00dev, MAC_CSR0, ®); | ||
145 | if (reg && reg != ~0) | ||
146 | break; | ||
147 | msleep(1); | ||
148 | } | ||
149 | |||
150 | if (i == REGISTER_BUSY_COUNT) { | ||
151 | ERROR(rt2x00dev, "Unstable hardware.\n"); | ||
152 | return -EBUSY; | 130 | return -EBUSY; |
153 | } | ||
154 | 131 | ||
155 | rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, ®); | 132 | rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, ®); |
156 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); | 133 | rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); |
157 | 134 | ||
135 | rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); | ||
136 | |||
158 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | 137 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); |
159 | rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); | 138 | rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); |
160 | rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); | 139 | rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); |
@@ -173,30 +152,10 @@ static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) | |||
173 | static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev) | 152 | static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev) |
174 | { | 153 | { |
175 | u32 reg; | 154 | u32 reg; |
176 | u16 word; | ||
177 | 155 | ||
178 | /* | 156 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev))) |
179 | * Initialize all registers. | ||
180 | */ | ||
181 | if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || | ||
182 | rt2800_init_registers(rt2x00dev) || | ||
183 | rt2800_init_bbp(rt2x00dev) || | ||
184 | rt2800_init_rfcsr(rt2x00dev))) | ||
185 | return -EIO; | 157 | return -EIO; |
186 | 158 | ||
187 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | ||
188 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); | ||
189 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
190 | |||
191 | udelay(50); | ||
192 | |||
193 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | ||
194 | rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); | ||
195 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1); | ||
196 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1); | ||
197 | rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); | ||
198 | |||
199 | |||
200 | rt2800_register_read(rt2x00dev, USB_DMA_CFG, ®); | 159 | rt2800_register_read(rt2x00dev, USB_DMA_CFG, ®); |
201 | rt2x00_set_field32(®, USB_DMA_CFG_PHY_CLEAR, 0); | 160 | rt2x00_set_field32(®, USB_DMA_CFG_PHY_CLEAR, 0); |
202 | rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_EN, 0); | 161 | rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_EN, 0); |
@@ -211,45 +170,12 @@ static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
211 | rt2x00_set_field32(®, USB_DMA_CFG_TX_BULK_EN, 1); | 170 | rt2x00_set_field32(®, USB_DMA_CFG_TX_BULK_EN, 1); |
212 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, reg); | 171 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, reg); |
213 | 172 | ||
214 | rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); | 173 | return rt2800_enable_radio(rt2x00dev); |
215 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); | ||
216 | rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); | ||
217 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); | ||
218 | |||
219 | /* | ||
220 | * Initialize LED control | ||
221 | */ | ||
222 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED1, &word); | ||
223 | rt2800_mcu_request(rt2x00dev, MCU_LED_1, 0xff, | ||
224 | word & 0xff, (word >> 8) & 0xff); | ||
225 | |||
226 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED2, &word); | ||
227 | rt2800_mcu_request(rt2x00dev, MCU_LED_2, 0xff, | ||
228 | word & 0xff, (word >> 8) & 0xff); | ||
229 | |||
230 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED3, &word); | ||
231 | rt2800_mcu_request(rt2x00dev, MCU_LED_3, 0xff, | ||
232 | word & 0xff, (word >> 8) & 0xff); | ||
233 | |||
234 | return 0; | ||
235 | } | 174 | } |
236 | 175 | ||
237 | static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev) | 176 | static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev) |
238 | { | 177 | { |
239 | u32 reg; | 178 | rt2800_disable_radio(rt2x00dev); |
240 | |||
241 | rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); | ||
242 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); | ||
243 | rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); | ||
244 | rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); | ||
245 | |||
246 | rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0); | ||
247 | rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0); | ||
248 | rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0); | ||
249 | |||
250 | /* Wait for DMA, ignore error */ | ||
251 | rt2800_wait_wpdma_ready(rt2x00dev); | ||
252 | |||
253 | rt2x00usb_disable_radio(rt2x00dev); | 179 | rt2x00usb_disable_radio(rt2x00dev); |
254 | } | 180 | } |
255 | 181 | ||
@@ -329,12 +255,11 @@ static __le32 *rt2800usb_get_txwi(struct queue_entry *entry) | |||
329 | return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE); | 255 | return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE); |
330 | } | 256 | } |
331 | 257 | ||
332 | static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 258 | static void rt2800usb_write_tx_desc(struct queue_entry *entry, |
333 | struct sk_buff *skb, | ||
334 | struct txentry_desc *txdesc) | 259 | struct txentry_desc *txdesc) |
335 | { | 260 | { |
336 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 261 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
337 | __le32 *txi = (__le32 *) skb->data; | 262 | __le32 *txi = (__le32 *) entry->skb->data; |
338 | u32 word; | 263 | u32 word; |
339 | 264 | ||
340 | /* | 265 | /* |
@@ -342,7 +267,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
342 | */ | 267 | */ |
343 | rt2x00_desc_read(txi, 0, &word); | 268 | rt2x00_desc_read(txi, 0, &word); |
344 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 269 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |
345 | skb->len - TXINFO_DESC_SIZE); | 270 | entry->skb->len - TXINFO_DESC_SIZE); |
346 | rt2x00_set_field32(&word, TXINFO_W0_WIV, | 271 | rt2x00_set_field32(&word, TXINFO_W0_WIV, |
347 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); | 272 | !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); |
348 | rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); | 273 | rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); |
@@ -410,6 +335,14 @@ static void rt2800usb_work_txdone(struct work_struct *work) | |||
410 | } | 335 | } |
411 | } | 336 | } |
412 | 337 | ||
338 | static void rt2800usb_kill_tx_queue(struct data_queue *queue) | ||
339 | { | ||
340 | if (queue->qid == QID_BEACON) | ||
341 | rt2x00usb_register_write(queue->rt2x00dev, BCN_TIME_CFG, 0); | ||
342 | |||
343 | rt2x00usb_kill_tx_queue(queue); | ||
344 | } | ||
345 | |||
413 | /* | 346 | /* |
414 | * RX control handlers | 347 | * RX control handlers |
415 | */ | 348 | */ |
@@ -608,7 +541,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | |||
608 | .write_beacon = rt2800_write_beacon, | 541 | .write_beacon = rt2800_write_beacon, |
609 | .get_tx_data_len = rt2800usb_get_tx_data_len, | 542 | .get_tx_data_len = rt2800usb_get_tx_data_len, |
610 | .kick_tx_queue = rt2x00usb_kick_tx_queue, | 543 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
611 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 544 | .kill_tx_queue = rt2800usb_kill_tx_queue, |
612 | .fill_rxdone = rt2800usb_fill_rxdone, | 545 | .fill_rxdone = rt2800usb_fill_rxdone, |
613 | .config_shared_key = rt2800_config_shared_key, | 546 | .config_shared_key = rt2800_config_shared_key, |
614 | .config_pairwise_key = rt2800_config_pairwise_key, | 547 | .config_pairwise_key = rt2800_config_pairwise_key, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 8c65244a847a..0ae942cb66df 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -213,8 +213,9 @@ struct channel_info { | |||
213 | unsigned int flags; | 213 | unsigned int flags; |
214 | #define GEOGRAPHY_ALLOWED 0x00000001 | 214 | #define GEOGRAPHY_ALLOWED 0x00000001 |
215 | 215 | ||
216 | short tx_power1; | 216 | short max_power; |
217 | short tx_power2; | 217 | short default_power1; |
218 | short default_power2; | ||
218 | }; | 219 | }; |
219 | 220 | ||
220 | /* | 221 | /* |
@@ -559,18 +560,15 @@ struct rt2x00lib_ops { | |||
559 | /* | 560 | /* |
560 | * TX control handlers | 561 | * TX control handlers |
561 | */ | 562 | */ |
562 | void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev, | 563 | void (*write_tx_desc) (struct queue_entry *entry, |
563 | struct sk_buff *skb, | ||
564 | struct txentry_desc *txdesc); | 564 | struct txentry_desc *txdesc); |
565 | void (*write_tx_data) (struct queue_entry *entry, | 565 | void (*write_tx_data) (struct queue_entry *entry, |
566 | struct txentry_desc *txdesc); | 566 | struct txentry_desc *txdesc); |
567 | void (*write_beacon) (struct queue_entry *entry, | 567 | void (*write_beacon) (struct queue_entry *entry, |
568 | struct txentry_desc *txdesc); | 568 | struct txentry_desc *txdesc); |
569 | int (*get_tx_data_len) (struct queue_entry *entry); | 569 | int (*get_tx_data_len) (struct queue_entry *entry); |
570 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 570 | void (*kick_tx_queue) (struct data_queue *queue); |
571 | const enum data_queue_qid queue); | 571 | void (*kill_tx_queue) (struct data_queue *queue); |
572 | void (*kill_tx_queue) (struct rt2x00_dev *rt2x00dev, | ||
573 | const enum data_queue_qid queue); | ||
574 | 572 | ||
575 | /* | 573 | /* |
576 | * RX control handlers | 574 | * RX control handlers |
@@ -1072,6 +1070,7 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
1072 | */ | 1070 | */ |
1073 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); | 1071 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); |
1074 | void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); | 1072 | void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); |
1073 | void rt2x00lib_dmadone(struct queue_entry *entry); | ||
1075 | void rt2x00lib_txdone(struct queue_entry *entry, | 1074 | void rt2x00lib_txdone(struct queue_entry *entry, |
1076 | struct txdone_entry_desc *txdesc); | 1075 | struct txdone_entry_desc *txdesc); |
1077 | void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); | 1076 | void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 2d018ceffc54..b8cf45c4e9f5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -338,7 +338,7 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file, | |||
338 | return -ENOMEM; | 338 | return -ENOMEM; |
339 | 339 | ||
340 | temp = data + | 340 | temp = data + |
341 | sprintf(data, "qid\tcount\tlimit\tlength\tindex\tdone\tcrypto\n"); | 341 | sprintf(data, "qid\tcount\tlimit\tlength\tindex\tdma done\tdone\n"); |
342 | 342 | ||
343 | queue_for_each(intf->rt2x00dev, queue) { | 343 | queue_for_each(intf->rt2x00dev, queue) { |
344 | spin_lock_irqsave(&queue->lock, irqflags); | 344 | spin_lock_irqsave(&queue->lock, irqflags); |
@@ -346,8 +346,8 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file, | |||
346 | temp += sprintf(temp, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", queue->qid, | 346 | temp += sprintf(temp, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", queue->qid, |
347 | queue->count, queue->limit, queue->length, | 347 | queue->count, queue->limit, queue->length, |
348 | queue->index[Q_INDEX], | 348 | queue->index[Q_INDEX], |
349 | queue->index[Q_INDEX_DONE], | 349 | queue->index[Q_INDEX_DMA_DONE], |
350 | queue->index[Q_INDEX_CRYPTO]); | 350 | queue->index[Q_INDEX_DONE]); |
351 | 351 | ||
352 | spin_unlock_irqrestore(&queue->lock, irqflags); | 352 | spin_unlock_irqrestore(&queue->lock, irqflags); |
353 | } | 353 | } |
@@ -481,6 +481,9 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ | |||
481 | if (index >= debug->__name.word_count) \ | 481 | if (index >= debug->__name.word_count) \ |
482 | return -EINVAL; \ | 482 | return -EINVAL; \ |
483 | \ | 483 | \ |
484 | if (length > sizeof(line)) \ | ||
485 | return -EINVAL; \ | ||
486 | \ | ||
484 | if (copy_from_user(line, buf, length)) \ | 487 | if (copy_from_user(line, buf, length)) \ |
485 | return -EFAULT; \ | 488 | return -EFAULT; \ |
486 | \ | 489 | \ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index e692608bee8b..053fdd3bd720 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -251,6 +251,12 @@ void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev) | |||
251 | } | 251 | } |
252 | EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt); | 252 | EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt); |
253 | 253 | ||
254 | void rt2x00lib_dmadone(struct queue_entry *entry) | ||
255 | { | ||
256 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DMA_DONE); | ||
257 | } | ||
258 | EXPORT_SYMBOL_GPL(rt2x00lib_dmadone); | ||
259 | |||
254 | void rt2x00lib_txdone(struct queue_entry *entry, | 260 | void rt2x00lib_txdone(struct queue_entry *entry, |
255 | struct txdone_entry_desc *txdesc) | 261 | struct txdone_entry_desc *txdesc) |
256 | { | 262 | { |
@@ -711,7 +717,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | |||
711 | for (i = 0; i < spec->num_channels; i++) { | 717 | for (i = 0; i < spec->num_channels; i++) { |
712 | rt2x00lib_channel(&channels[i], | 718 | rt2x00lib_channel(&channels[i], |
713 | spec->channels[i].channel, | 719 | spec->channels[i].channel, |
714 | spec->channels_info[i].tx_power1, i); | 720 | spec->channels_info[i].max_power, i); |
715 | } | 721 | } |
716 | 722 | ||
717 | /* | 723 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 480d33a3ce42..eede99939db9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -312,7 +312,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
312 | /* | 312 | /* |
313 | * Initialize information from queue | 313 | * Initialize information from queue |
314 | */ | 314 | */ |
315 | txdesc->queue = entry->queue->qid; | 315 | txdesc->qid = entry->queue->qid; |
316 | txdesc->cw_min = entry->queue->cw_min; | 316 | txdesc->cw_min = entry->queue->cw_min; |
317 | txdesc->cw_max = entry->queue->cw_max; | 317 | txdesc->cw_max = entry->queue->cw_max; |
318 | txdesc->aifs = entry->queue->aifs; | 318 | txdesc->aifs = entry->queue->aifs; |
@@ -449,15 +449,14 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, | |||
449 | struct txentry_desc *txdesc) | 449 | struct txentry_desc *txdesc) |
450 | { | 450 | { |
451 | struct data_queue *queue = entry->queue; | 451 | struct data_queue *queue = entry->queue; |
452 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
453 | 452 | ||
454 | rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc); | 453 | queue->rt2x00dev->ops->lib->write_tx_desc(entry, txdesc); |
455 | 454 | ||
456 | /* | 455 | /* |
457 | * All processing on the frame has been completed, this means | 456 | * All processing on the frame has been completed, this means |
458 | * it is now ready to be dumped to userspace through debugfs. | 457 | * it is now ready to be dumped to userspace through debugfs. |
459 | */ | 458 | */ |
460 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); | 459 | rt2x00debug_dump_frame(queue->rt2x00dev, DUMP_FRAME_TX, entry->skb); |
461 | } | 460 | } |
462 | 461 | ||
463 | static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, | 462 | static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, |
@@ -477,7 +476,7 @@ static void rt2x00queue_kick_tx_queue(struct queue_entry *entry, | |||
477 | */ | 476 | */ |
478 | if (rt2x00queue_threshold(queue) || | 477 | if (rt2x00queue_threshold(queue) || |
479 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) | 478 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) |
480 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); | 479 | rt2x00dev->ops->lib->kick_tx_queue(queue); |
481 | } | 480 | } |
482 | 481 | ||
483 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, | 482 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, |
@@ -591,7 +590,7 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
591 | intf->beacon->skb = NULL; | 590 | intf->beacon->skb = NULL; |
592 | 591 | ||
593 | if (!enable_beacon) { | 592 | if (!enable_beacon) { |
594 | rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_BEACON); | 593 | rt2x00dev->ops->lib->kill_tx_queue(intf->beacon->queue); |
595 | mutex_unlock(&intf->beacon_skb_mutex); | 594 | mutex_unlock(&intf->beacon_skb_mutex); |
596 | return 0; | 595 | return 0; |
597 | } | 596 | } |
@@ -626,6 +625,51 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, | |||
626 | return 0; | 625 | return 0; |
627 | } | 626 | } |
628 | 627 | ||
628 | void rt2x00queue_for_each_entry(struct data_queue *queue, | ||
629 | enum queue_index start, | ||
630 | enum queue_index end, | ||
631 | void (*fn)(struct queue_entry *entry)) | ||
632 | { | ||
633 | unsigned long irqflags; | ||
634 | unsigned int index_start; | ||
635 | unsigned int index_end; | ||
636 | unsigned int i; | ||
637 | |||
638 | if (unlikely(start >= Q_INDEX_MAX || end >= Q_INDEX_MAX)) { | ||
639 | ERROR(queue->rt2x00dev, | ||
640 | "Entry requested from invalid index range (%d - %d)\n", | ||
641 | start, end); | ||
642 | return; | ||
643 | } | ||
644 | |||
645 | /* | ||
646 | * Only protect the range we are going to loop over, | ||
647 | * if during our loop a extra entry is set to pending | ||
648 | * it should not be kicked during this run, since it | ||
649 | * is part of another TX operation. | ||
650 | */ | ||
651 | spin_lock_irqsave(&queue->lock, irqflags); | ||
652 | index_start = queue->index[start]; | ||
653 | index_end = queue->index[end]; | ||
654 | spin_unlock_irqrestore(&queue->lock, irqflags); | ||
655 | |||
656 | /* | ||
657 | * Start from the TX done pointer, this guarentees that we will | ||
658 | * send out all frames in the correct order. | ||
659 | */ | ||
660 | if (index_start < index_end) { | ||
661 | for (i = index_start; i < index_end; i++) | ||
662 | fn(&queue->entries[i]); | ||
663 | } else { | ||
664 | for (i = index_start; i < queue->limit; i++) | ||
665 | fn(&queue->entries[i]); | ||
666 | |||
667 | for (i = 0; i < index_end; i++) | ||
668 | fn(&queue->entries[i]); | ||
669 | } | ||
670 | } | ||
671 | EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry); | ||
672 | |||
629 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | 673 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, |
630 | const enum data_queue_qid queue) | 674 | const enum data_queue_qid queue) |
631 | { | 675 | { |
@@ -687,13 +731,13 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index) | |||
687 | if (queue->index[index] >= queue->limit) | 731 | if (queue->index[index] >= queue->limit) |
688 | queue->index[index] = 0; | 732 | queue->index[index] = 0; |
689 | 733 | ||
734 | queue->last_action[index] = jiffies; | ||
735 | |||
690 | if (index == Q_INDEX) { | 736 | if (index == Q_INDEX) { |
691 | queue->length++; | 737 | queue->length++; |
692 | queue->last_index = jiffies; | ||
693 | } else if (index == Q_INDEX_DONE) { | 738 | } else if (index == Q_INDEX_DONE) { |
694 | queue->length--; | 739 | queue->length--; |
695 | queue->count++; | 740 | queue->count++; |
696 | queue->last_index_done = jiffies; | ||
697 | } | 741 | } |
698 | 742 | ||
699 | spin_unlock_irqrestore(&queue->lock, irqflags); | 743 | spin_unlock_irqrestore(&queue->lock, irqflags); |
@@ -702,14 +746,17 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index) | |||
702 | static void rt2x00queue_reset(struct data_queue *queue) | 746 | static void rt2x00queue_reset(struct data_queue *queue) |
703 | { | 747 | { |
704 | unsigned long irqflags; | 748 | unsigned long irqflags; |
749 | unsigned int i; | ||
705 | 750 | ||
706 | spin_lock_irqsave(&queue->lock, irqflags); | 751 | spin_lock_irqsave(&queue->lock, irqflags); |
707 | 752 | ||
708 | queue->count = 0; | 753 | queue->count = 0; |
709 | queue->length = 0; | 754 | queue->length = 0; |
710 | queue->last_index = jiffies; | 755 | |
711 | queue->last_index_done = jiffies; | 756 | for (i = 0; i < Q_INDEX_MAX; i++) { |
712 | memset(queue->index, 0, sizeof(queue->index)); | 757 | queue->index[i] = 0; |
758 | queue->last_action[i] = jiffies; | ||
759 | } | ||
713 | 760 | ||
714 | spin_unlock_irqrestore(&queue->lock, irqflags); | 761 | spin_unlock_irqrestore(&queue->lock, irqflags); |
715 | } | 762 | } |
@@ -719,7 +766,7 @@ void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev) | |||
719 | struct data_queue *queue; | 766 | struct data_queue *queue; |
720 | 767 | ||
721 | txall_queue_for_each(rt2x00dev, queue) | 768 | txall_queue_for_each(rt2x00dev, queue) |
722 | rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, queue->qid); | 769 | rt2x00dev->ops->lib->kill_tx_queue(queue); |
723 | } | 770 | } |
724 | 771 | ||
725 | void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) | 772 | void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 2d3bf843735f..d81d85f34866 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -296,7 +296,7 @@ enum txentry_desc_flags { | |||
296 | * Summary of information for the frame descriptor before sending a TX frame. | 296 | * Summary of information for the frame descriptor before sending a TX frame. |
297 | * | 297 | * |
298 | * @flags: Descriptor flags (See &enum queue_entry_flags). | 298 | * @flags: Descriptor flags (See &enum queue_entry_flags). |
299 | * @queue: Queue identification (See &enum data_queue_qid). | 299 | * @qid: Queue identification (See &enum data_queue_qid). |
300 | * @length: Length of the entire frame. | 300 | * @length: Length of the entire frame. |
301 | * @header_length: Length of 802.11 header. | 301 | * @header_length: Length of 802.11 header. |
302 | * @length_high: PLCP length high word. | 302 | * @length_high: PLCP length high word. |
@@ -322,7 +322,7 @@ enum txentry_desc_flags { | |||
322 | struct txentry_desc { | 322 | struct txentry_desc { |
323 | unsigned long flags; | 323 | unsigned long flags; |
324 | 324 | ||
325 | enum data_queue_qid queue; | 325 | enum data_queue_qid qid; |
326 | 326 | ||
327 | u16 length; | 327 | u16 length; |
328 | u16 header_length; | 328 | u16 header_length; |
@@ -360,9 +360,6 @@ struct txentry_desc { | |||
360 | * @ENTRY_OWNER_DEVICE_DATA: This entry is owned by the device for data | 360 | * @ENTRY_OWNER_DEVICE_DATA: This entry is owned by the device for data |
361 | * transfer (either TX or RX depending on the queue). The entry should | 361 | * transfer (either TX or RX depending on the queue). The entry should |
362 | * only be touched after the device has signaled it is done with it. | 362 | * only be touched after the device has signaled it is done with it. |
363 | * @ENTRY_OWNER_DEVICE_CRYPTO: This entry is owned by the device for data | ||
364 | * encryption or decryption. The entry should only be touched after | ||
365 | * the device has signaled it is done with it. | ||
366 | * @ENTRY_DATA_PENDING: This entry contains a valid frame and is waiting | 363 | * @ENTRY_DATA_PENDING: This entry contains a valid frame and is waiting |
367 | * for the signal to start sending. | 364 | * for the signal to start sending. |
368 | * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occured | 365 | * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occured |
@@ -372,7 +369,6 @@ struct txentry_desc { | |||
372 | enum queue_entry_flags { | 369 | enum queue_entry_flags { |
373 | ENTRY_BCN_ASSIGNED, | 370 | ENTRY_BCN_ASSIGNED, |
374 | ENTRY_OWNER_DEVICE_DATA, | 371 | ENTRY_OWNER_DEVICE_DATA, |
375 | ENTRY_OWNER_DEVICE_CRYPTO, | ||
376 | ENTRY_DATA_PENDING, | 372 | ENTRY_DATA_PENDING, |
377 | ENTRY_DATA_IO_FAILED | 373 | ENTRY_DATA_IO_FAILED |
378 | }; | 374 | }; |
@@ -405,18 +401,18 @@ struct queue_entry { | |||
405 | * | 401 | * |
406 | * @Q_INDEX: Index pointer to the current entry in the queue, if this entry is | 402 | * @Q_INDEX: Index pointer to the current entry in the queue, if this entry is |
407 | * owned by the hardware then the queue is considered to be full. | 403 | * owned by the hardware then the queue is considered to be full. |
404 | * @Q_INDEX_DMA_DONE: Index pointer for the next entry which will have been | ||
405 | * transfered to the hardware. | ||
408 | * @Q_INDEX_DONE: Index pointer to the next entry which will be completed by | 406 | * @Q_INDEX_DONE: Index pointer to the next entry which will be completed by |
409 | * the hardware and for which we need to run the txdone handler. If this | 407 | * the hardware and for which we need to run the txdone handler. If this |
410 | * entry is not owned by the hardware the queue is considered to be empty. | 408 | * entry is not owned by the hardware the queue is considered to be empty. |
411 | * @Q_INDEX_CRYPTO: Index pointer to the next entry which encryption/decription | ||
412 | * will be completed by the hardware next. | ||
413 | * @Q_INDEX_MAX: Keep last, used in &struct data_queue to determine the size | 409 | * @Q_INDEX_MAX: Keep last, used in &struct data_queue to determine the size |
414 | * of the index array. | 410 | * of the index array. |
415 | */ | 411 | */ |
416 | enum queue_index { | 412 | enum queue_index { |
417 | Q_INDEX, | 413 | Q_INDEX, |
414 | Q_INDEX_DMA_DONE, | ||
418 | Q_INDEX_DONE, | 415 | Q_INDEX_DONE, |
419 | Q_INDEX_CRYPTO, | ||
420 | Q_INDEX_MAX, | 416 | Q_INDEX_MAX, |
421 | }; | 417 | }; |
422 | 418 | ||
@@ -452,13 +448,12 @@ struct data_queue { | |||
452 | enum data_queue_qid qid; | 448 | enum data_queue_qid qid; |
453 | 449 | ||
454 | spinlock_t lock; | 450 | spinlock_t lock; |
455 | unsigned long last_index; | ||
456 | unsigned long last_index_done; | ||
457 | unsigned int count; | 451 | unsigned int count; |
458 | unsigned short limit; | 452 | unsigned short limit; |
459 | unsigned short threshold; | 453 | unsigned short threshold; |
460 | unsigned short length; | 454 | unsigned short length; |
461 | unsigned short index[Q_INDEX_MAX]; | 455 | unsigned short index[Q_INDEX_MAX]; |
456 | unsigned long last_action[Q_INDEX_MAX]; | ||
462 | 457 | ||
463 | unsigned short txop; | 458 | unsigned short txop; |
464 | unsigned short aifs; | 459 | unsigned short aifs; |
@@ -571,6 +566,22 @@ struct data_queue_desc { | |||
571 | queue_loop(__entry, (__dev)->tx, queue_end(__dev)) | 566 | queue_loop(__entry, (__dev)->tx, queue_end(__dev)) |
572 | 567 | ||
573 | /** | 568 | /** |
569 | * rt2x00queue_for_each_entry - Loop through all entries in the queue | ||
570 | * @queue: Pointer to @data_queue | ||
571 | * @start: &enum queue_index Pointer to start index | ||
572 | * @end: &enum queue_index Pointer to end index | ||
573 | * @fn: The function to call for each &struct queue_entry | ||
574 | * | ||
575 | * This will walk through all entries in the queue, in chronological | ||
576 | * order. This means it will start at the current @start pointer | ||
577 | * and will walk through the queue until it reaches the @end pointer. | ||
578 | */ | ||
579 | void rt2x00queue_for_each_entry(struct data_queue *queue, | ||
580 | enum queue_index start, | ||
581 | enum queue_index end, | ||
582 | void (*fn)(struct queue_entry *entry)); | ||
583 | |||
584 | /** | ||
574 | * rt2x00queue_empty - Check if the queue is empty. | 585 | * rt2x00queue_empty - Check if the queue is empty. |
575 | * @queue: Queue to check if empty. | 586 | * @queue: Queue to check if empty. |
576 | */ | 587 | */ |
@@ -607,12 +618,23 @@ static inline int rt2x00queue_threshold(struct data_queue *queue) | |||
607 | } | 618 | } |
608 | 619 | ||
609 | /** | 620 | /** |
610 | * rt2x00queue_timeout - Check if a timeout occured for this queue | 621 | * rt2x00queue_timeout - Check if a timeout occured for STATUS reorts |
611 | * @queue: Queue to check. | 622 | * @queue: Queue to check. |
612 | */ | 623 | */ |
613 | static inline int rt2x00queue_timeout(struct data_queue *queue) | 624 | static inline int rt2x00queue_timeout(struct data_queue *queue) |
614 | { | 625 | { |
615 | return time_after(queue->last_index, queue->last_index_done + (HZ / 10)); | 626 | return time_after(queue->last_action[Q_INDEX_DMA_DONE], |
627 | queue->last_action[Q_INDEX_DONE] + (HZ / 10)); | ||
628 | } | ||
629 | |||
630 | /** | ||
631 | * rt2x00queue_timeout - Check if a timeout occured for DMA transfers | ||
632 | * @queue: Queue to check. | ||
633 | */ | ||
634 | static inline int rt2x00queue_dma_timeout(struct data_queue *queue) | ||
635 | { | ||
636 | return time_after(queue->last_action[Q_INDEX], | ||
637 | queue->last_action[Q_INDEX_DMA_DONE] + (HZ / 10)); | ||
616 | } | 638 | } |
617 | 639 | ||
618 | /** | 640 | /** |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index f76014f732ce..4c5ae3d45625 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -208,11 +208,15 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb) | |||
208 | struct queue_entry *entry = (struct queue_entry *)urb->context; | 208 | struct queue_entry *entry = (struct queue_entry *)urb->context; |
209 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 209 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
210 | 210 | ||
211 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) || | 211 | if (!__test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) |
212 | !__test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | ||
213 | return; | 212 | return; |
214 | 213 | ||
215 | /* | 214 | /* |
215 | * Report the frame as DMA done | ||
216 | */ | ||
217 | rt2x00lib_dmadone(entry); | ||
218 | |||
219 | /* | ||
216 | * Check if the frame was correctly uploaded | 220 | * Check if the frame was correctly uploaded |
217 | */ | 221 | */ |
218 | if (urb->status) | 222 | if (urb->status) |
@@ -222,112 +226,84 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb) | |||
222 | * Schedule the delayed work for reading the TX status | 226 | * Schedule the delayed work for reading the TX status |
223 | * from the device. | 227 | * from the device. |
224 | */ | 228 | */ |
225 | ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->txdone_work); | 229 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && |
230 | test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
231 | ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->txdone_work); | ||
226 | } | 232 | } |
227 | 233 | ||
228 | static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry) | 234 | static void rt2x00usb_kick_tx_entry(struct queue_entry *entry) |
229 | { | 235 | { |
230 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 236 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
231 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); | 237 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
232 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | 238 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; |
233 | u32 length; | 239 | u32 length; |
234 | 240 | ||
235 | if (test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) { | 241 | if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) |
236 | /* | 242 | return; |
237 | * USB devices cannot blindly pass the skb->len as the | ||
238 | * length of the data to usb_fill_bulk_urb. Pass the skb | ||
239 | * to the driver to determine what the length should be. | ||
240 | */ | ||
241 | length = rt2x00dev->ops->lib->get_tx_data_len(entry); | ||
242 | |||
243 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, | ||
244 | usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint), | ||
245 | entry->skb->data, length, | ||
246 | rt2x00usb_interrupt_txdone, entry); | ||
247 | |||
248 | usb_submit_urb(entry_priv->urb, GFP_ATOMIC); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | ||
253 | const enum data_queue_qid qid) | ||
254 | { | ||
255 | struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, qid); | ||
256 | unsigned long irqflags; | ||
257 | unsigned int index; | ||
258 | unsigned int index_done; | ||
259 | unsigned int i; | ||
260 | 243 | ||
261 | /* | 244 | /* |
262 | * Only protect the range we are going to loop over, | 245 | * USB devices cannot blindly pass the skb->len as the |
263 | * if during our loop a extra entry is set to pending | 246 | * length of the data to usb_fill_bulk_urb. Pass the skb |
264 | * it should not be kicked during this run, since it | 247 | * to the driver to determine what the length should be. |
265 | * is part of another TX operation. | ||
266 | */ | 248 | */ |
267 | spin_lock_irqsave(&queue->lock, irqflags); | 249 | length = rt2x00dev->ops->lib->get_tx_data_len(entry); |
268 | index = queue->index[Q_INDEX]; | ||
269 | index_done = queue->index[Q_INDEX_DONE]; | ||
270 | spin_unlock_irqrestore(&queue->lock, irqflags); | ||
271 | 250 | ||
272 | /* | 251 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, |
273 | * Start from the TX done pointer, this guarentees that we will | 252 | usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint), |
274 | * send out all frames in the correct order. | 253 | entry->skb->data, length, |
275 | */ | 254 | rt2x00usb_interrupt_txdone, entry); |
276 | if (index_done < index) { | ||
277 | for (i = index_done; i < index; i++) | ||
278 | rt2x00usb_kick_tx_entry(&queue->entries[i]); | ||
279 | } else { | ||
280 | for (i = index_done; i < queue->limit; i++) | ||
281 | rt2x00usb_kick_tx_entry(&queue->entries[i]); | ||
282 | 255 | ||
283 | for (i = 0; i < index; i++) | 256 | usb_submit_urb(entry_priv->urb, GFP_ATOMIC); |
284 | rt2x00usb_kick_tx_entry(&queue->entries[i]); | 257 | } |
285 | } | 258 | |
259 | void rt2x00usb_kick_tx_queue(struct data_queue *queue) | ||
260 | { | ||
261 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, | ||
262 | rt2x00usb_kick_tx_entry); | ||
286 | } | 263 | } |
287 | EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue); | 264 | EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue); |
288 | 265 | ||
289 | void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 266 | static void rt2x00usb_kill_tx_entry(struct queue_entry *entry) |
290 | const enum data_queue_qid qid) | ||
291 | { | 267 | { |
292 | struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, qid); | 268 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
293 | struct queue_entry_priv_usb *entry_priv; | 269 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; |
294 | struct queue_entry_priv_usb_bcn *bcn_priv; | 270 | struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; |
295 | unsigned int i; | 271 | |
296 | bool kill_guard; | 272 | if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) |
273 | return; | ||
274 | |||
275 | usb_kill_urb(entry_priv->urb); | ||
297 | 276 | ||
298 | /* | 277 | /* |
299 | * When killing the beacon queue, we must also kill | 278 | * Kill guardian urb (if required by driver). |
300 | * the beacon guard byte. | ||
301 | */ | 279 | */ |
302 | kill_guard = | 280 | if ((entry->queue->qid == QID_BEACON) && |
303 | (qid == QID_BEACON) && | 281 | (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))) |
304 | (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)); | 282 | usb_kill_urb(bcn_priv->guardian_urb); |
305 | 283 | ||
306 | /* | 284 | /* |
307 | * Cancel all entries. | 285 | * We need a short delay here to wait for |
286 | * the URB to be canceled | ||
308 | */ | 287 | */ |
309 | for (i = 0; i < queue->limit; i++) { | 288 | do { |
310 | entry_priv = queue->entries[i].priv_data; | 289 | udelay(100); |
311 | usb_kill_urb(entry_priv->urb); | 290 | } while (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)); |
291 | } | ||
312 | 292 | ||
313 | /* | 293 | void rt2x00usb_kill_tx_queue(struct data_queue *queue) |
314 | * Kill guardian urb (if required by driver). | 294 | { |
315 | */ | 295 | rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, |
316 | if (kill_guard) { | 296 | rt2x00usb_kill_tx_entry); |
317 | bcn_priv = queue->entries[i].priv_data; | ||
318 | usb_kill_urb(bcn_priv->guardian_urb); | ||
319 | } | ||
320 | } | ||
321 | } | 297 | } |
322 | EXPORT_SYMBOL_GPL(rt2x00usb_kill_tx_queue); | 298 | EXPORT_SYMBOL_GPL(rt2x00usb_kill_tx_queue); |
323 | 299 | ||
324 | static void rt2x00usb_watchdog_reset_tx(struct data_queue *queue) | 300 | static void rt2x00usb_watchdog_tx_dma(struct data_queue *queue) |
325 | { | 301 | { |
326 | struct queue_entry *entry; | 302 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; |
327 | struct queue_entry_priv_usb *entry_priv; | ||
328 | unsigned short threshold = queue->threshold; | 303 | unsigned short threshold = queue->threshold; |
329 | 304 | ||
330 | WARNING(queue->rt2x00dev, "TX queue %d timed out, invoke reset", queue->qid); | 305 | WARNING(queue->rt2x00dev, "TX queue %d DMA timed out," |
306 | " invoke forced forced reset", queue->qid); | ||
331 | 307 | ||
332 | /* | 308 | /* |
333 | * Temporarily disable the TX queue, this will force mac80211 | 309 | * Temporarily disable the TX queue, this will force mac80211 |
@@ -337,28 +313,33 @@ static void rt2x00usb_watchdog_reset_tx(struct data_queue *queue) | |||
337 | * queue from being enabled during the txdone handler. | 313 | * queue from being enabled during the txdone handler. |
338 | */ | 314 | */ |
339 | queue->threshold = queue->limit; | 315 | queue->threshold = queue->limit; |
340 | ieee80211_stop_queue(queue->rt2x00dev->hw, queue->qid); | 316 | ieee80211_stop_queue(rt2x00dev->hw, queue->qid); |
341 | 317 | ||
342 | /* | 318 | /* |
343 | * Reset all currently uploaded TX frames. | 319 | * Kill all entries in the queue, afterwards we need to |
320 | * wait a bit for all URBs to be cancelled. | ||
344 | */ | 321 | */ |
345 | while (!rt2x00queue_empty(queue)) { | 322 | rt2x00usb_kill_tx_queue(queue); |
346 | entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); | ||
347 | entry_priv = entry->priv_data; | ||
348 | usb_kill_urb(entry_priv->urb); | ||
349 | 323 | ||
350 | /* | 324 | /* |
351 | * We need a short delay here to wait for | 325 | * In case that a driver has overriden the txdone_work |
352 | * the URB to be canceled | 326 | * function, we invoke the TX done through there. |
353 | */ | 327 | */ |
354 | do { | 328 | rt2x00dev->txdone_work.func(&rt2x00dev->txdone_work); |
355 | udelay(100); | ||
356 | } while (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)); | ||
357 | 329 | ||
358 | /* | 330 | /* |
359 | * Invoke the TX done handler | 331 | * Security measure: if the driver did override the |
360 | */ | 332 | * txdone_work function, and the hardware did arrive |
361 | rt2x00usb_work_txdone_entry(entry); | 333 | * in a state which causes it to malfunction, it is |
334 | * possible that the driver couldn't handle the txdone | ||
335 | * event correctly. So after giving the driver the | ||
336 | * chance to cleanup, we now force a cleanup of any | ||
337 | * leftovers. | ||
338 | */ | ||
339 | if (!rt2x00queue_empty(queue)) { | ||
340 | WARNING(queue->rt2x00dev, "TX queue %d DMA timed out," | ||
341 | " status handling failed, invoke hard reset", queue->qid); | ||
342 | rt2x00usb_work_txdone(&rt2x00dev->txdone_work); | ||
362 | } | 343 | } |
363 | 344 | ||
364 | /* | 345 | /* |
@@ -366,7 +347,15 @@ static void rt2x00usb_watchdog_reset_tx(struct data_queue *queue) | |||
366 | * queue again. | 347 | * queue again. |
367 | */ | 348 | */ |
368 | queue->threshold = threshold; | 349 | queue->threshold = threshold; |
369 | ieee80211_wake_queue(queue->rt2x00dev->hw, queue->qid); | 350 | ieee80211_wake_queue(rt2x00dev->hw, queue->qid); |
351 | } | ||
352 | |||
353 | static void rt2x00usb_watchdog_tx_status(struct data_queue *queue) | ||
354 | { | ||
355 | WARNING(queue->rt2x00dev, "TX queue %d status timed out," | ||
356 | " invoke forced tx handler", queue->qid); | ||
357 | |||
358 | ieee80211_queue_work(queue->rt2x00dev->hw, &queue->rt2x00dev->txdone_work); | ||
370 | } | 359 | } |
371 | 360 | ||
372 | void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) | 361 | void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) |
@@ -374,8 +363,10 @@ void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) | |||
374 | struct data_queue *queue; | 363 | struct data_queue *queue; |
375 | 364 | ||
376 | tx_queue_for_each(rt2x00dev, queue) { | 365 | tx_queue_for_each(rt2x00dev, queue) { |
366 | if (rt2x00queue_dma_timeout(queue)) | ||
367 | rt2x00usb_watchdog_tx_dma(queue); | ||
377 | if (rt2x00queue_timeout(queue)) | 368 | if (rt2x00queue_timeout(queue)) |
378 | rt2x00usb_watchdog_reset_tx(queue); | 369 | rt2x00usb_watchdog_tx_status(queue); |
379 | } | 370 | } |
380 | } | 371 | } |
381 | EXPORT_SYMBOL_GPL(rt2x00usb_watchdog); | 372 | EXPORT_SYMBOL_GPL(rt2x00usb_watchdog); |
@@ -416,11 +407,15 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
416 | struct queue_entry *entry = (struct queue_entry *)urb->context; | 407 | struct queue_entry *entry = (struct queue_entry *)urb->context; |
417 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 408 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
418 | 409 | ||
419 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) || | 410 | if (!__test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) |
420 | !__test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | ||
421 | return; | 411 | return; |
422 | 412 | ||
423 | /* | 413 | /* |
414 | * Report the frame as DMA done | ||
415 | */ | ||
416 | rt2x00lib_dmadone(entry); | ||
417 | |||
418 | /* | ||
424 | * Check if the received data is simply too small | 419 | * Check if the received data is simply too small |
425 | * to be actually valid, or if the urb is signaling | 420 | * to be actually valid, or if the urb is signaling |
426 | * a problem. | 421 | * a problem. |
@@ -432,7 +427,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
432 | * Schedule the delayed work for reading the RX status | 427 | * Schedule the delayed work for reading the RX status |
433 | * from the device. | 428 | * from the device. |
434 | */ | 429 | */ |
435 | ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->rxdone_work); | 430 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && |
431 | test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
432 | ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->rxdone_work); | ||
436 | } | 433 | } |
437 | 434 | ||
438 | /* | 435 | /* |
@@ -447,7 +444,7 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
447 | * The USB version of kill_tx_queue also works | 444 | * The USB version of kill_tx_queue also works |
448 | * on the RX queue. | 445 | * on the RX queue. |
449 | */ | 446 | */ |
450 | rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_RX); | 447 | rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev->rx); |
451 | } | 448 | } |
452 | EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); | 449 | EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); |
453 | 450 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index d3d3ddc40875..c2d997f67b3e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -379,25 +379,21 @@ struct queue_entry_priv_usb_bcn { | |||
379 | 379 | ||
380 | /** | 380 | /** |
381 | * rt2x00usb_kick_tx_queue - Kick data queue | 381 | * rt2x00usb_kick_tx_queue - Kick data queue |
382 | * @rt2x00dev: Pointer to &struct rt2x00_dev | 382 | * @queue: Data queue to kick |
383 | * @qid: Data queue to kick | ||
384 | * | 383 | * |
385 | * This will walk through all entries of the queue and push all pending | 384 | * This will walk through all entries of the queue and push all pending |
386 | * frames to the hardware as a single burst. | 385 | * frames to the hardware as a single burst. |
387 | */ | 386 | */ |
388 | void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 387 | void rt2x00usb_kick_tx_queue(struct data_queue *queue); |
389 | const enum data_queue_qid qid); | ||
390 | 388 | ||
391 | /** | 389 | /** |
392 | * rt2x00usb_kill_tx_queue - Kill data queue | 390 | * rt2x00usb_kill_tx_queue - Kill data queue |
393 | * @rt2x00dev: Pointer to &struct rt2x00_dev | 391 | * @queue: Data queue to kill |
394 | * @qid: Data queue to kill | ||
395 | * | 392 | * |
396 | * This will walk through all entries of the queue and kill all | 393 | * This will walk through all entries of the queue and kill all |
397 | * previously kicked frames before they can be send. | 394 | * previously kicked frames before they can be send. |
398 | */ | 395 | */ |
399 | void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 396 | void rt2x00usb_kill_tx_queue(struct data_queue *queue); |
400 | const enum data_queue_qid qid); | ||
401 | 397 | ||
402 | /** | 398 | /** |
403 | * rt2x00usb_watchdog - Watchdog for USB communication | 399 | * rt2x00usb_watchdog - Watchdog for USB communication |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 3f8d10b76fee..3a7759929190 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1766,12 +1766,11 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1766 | /* | 1766 | /* |
1767 | * TX descriptor initialization | 1767 | * TX descriptor initialization |
1768 | */ | 1768 | */ |
1769 | static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1769 | static void rt61pci_write_tx_desc(struct queue_entry *entry, |
1770 | struct sk_buff *skb, | ||
1771 | struct txentry_desc *txdesc) | 1770 | struct txentry_desc *txdesc) |
1772 | { | 1771 | { |
1773 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1772 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1774 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1773 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1775 | __le32 *txd = entry_priv->desc; | 1774 | __le32 *txd = entry_priv->desc; |
1776 | u32 word; | 1775 | u32 word; |
1777 | 1776 | ||
@@ -1779,7 +1778,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1779 | * Start writing the descriptor words. | 1778 | * Start writing the descriptor words. |
1780 | */ | 1779 | */ |
1781 | rt2x00_desc_read(txd, 1, &word); | 1780 | rt2x00_desc_read(txd, 1, &word); |
1782 | rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, txdesc->queue); | 1781 | rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, txdesc->qid); |
1783 | rt2x00_set_field32(&word, TXD_W1_AIFSN, txdesc->aifs); | 1782 | rt2x00_set_field32(&word, TXD_W1_AIFSN, txdesc->aifs); |
1784 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); | 1783 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); |
1785 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); | 1784 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); |
@@ -1802,15 +1801,15 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1802 | } | 1801 | } |
1803 | 1802 | ||
1804 | rt2x00_desc_read(txd, 5, &word); | 1803 | rt2x00_desc_read(txd, 5, &word); |
1805 | rt2x00_set_field32(&word, TXD_W5_PID_TYPE, skbdesc->entry->queue->qid); | 1804 | rt2x00_set_field32(&word, TXD_W5_PID_TYPE, entry->queue->qid); |
1806 | rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, | 1805 | rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, |
1807 | skbdesc->entry->entry_idx); | 1806 | skbdesc->entry->entry_idx); |
1808 | rt2x00_set_field32(&word, TXD_W5_TX_POWER, | 1807 | rt2x00_set_field32(&word, TXD_W5_TX_POWER, |
1809 | TXPOWER_TO_DEV(rt2x00dev->tx_power)); | 1808 | TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power)); |
1810 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); | 1809 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); |
1811 | rt2x00_desc_write(txd, 5, word); | 1810 | rt2x00_desc_write(txd, 5, word); |
1812 | 1811 | ||
1813 | if (txdesc->queue != QID_BEACON) { | 1812 | if (txdesc->qid != QID_BEACON) { |
1814 | rt2x00_desc_read(txd, 6, &word); | 1813 | rt2x00_desc_read(txd, 6, &word); |
1815 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, | 1814 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, |
1816 | skbdesc->skb_dma); | 1815 | skbdesc->skb_dma); |
@@ -1857,7 +1856,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1857 | */ | 1856 | */ |
1858 | skbdesc->desc = txd; | 1857 | skbdesc->desc = txd; |
1859 | skbdesc->desc_len = | 1858 | skbdesc->desc_len = |
1860 | (txdesc->queue == QID_BEACON) ? TXINFO_SIZE : TXD_DESC_SIZE; | 1859 | (txdesc->qid == QID_BEACON) ? TXINFO_SIZE : TXD_DESC_SIZE; |
1861 | } | 1860 | } |
1862 | 1861 | ||
1863 | /* | 1862 | /* |
@@ -1882,7 +1881,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1882 | /* | 1881 | /* |
1883 | * Write the TX descriptor for the beacon. | 1882 | * Write the TX descriptor for the beacon. |
1884 | */ | 1883 | */ |
1885 | rt61pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1884 | rt61pci_write_tx_desc(entry, txdesc); |
1886 | 1885 | ||
1887 | /* | 1886 | /* |
1888 | * Dump beacon to userspace through debugfs. | 1887 | * Dump beacon to userspace through debugfs. |
@@ -1918,34 +1917,34 @@ static void rt61pci_write_beacon(struct queue_entry *entry, | |||
1918 | entry->skb = NULL; | 1917 | entry->skb = NULL; |
1919 | } | 1918 | } |
1920 | 1919 | ||
1921 | static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1920 | static void rt61pci_kick_tx_queue(struct data_queue *queue) |
1922 | const enum data_queue_qid queue) | ||
1923 | { | 1921 | { |
1922 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1924 | u32 reg; | 1923 | u32 reg; |
1925 | 1924 | ||
1926 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | 1925 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); |
1927 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue == QID_AC_BE)); | 1926 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, (queue->qid == QID_AC_BE)); |
1928 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue == QID_AC_BK)); | 1927 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, (queue->qid == QID_AC_BK)); |
1929 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC2, (queue == QID_AC_VI)); | 1928 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC2, (queue->qid == QID_AC_VI)); |
1930 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC3, (queue == QID_AC_VO)); | 1929 | rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC3, (queue->qid == QID_AC_VO)); |
1931 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | 1930 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); |
1932 | } | 1931 | } |
1933 | 1932 | ||
1934 | static void rt61pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 1933 | static void rt61pci_kill_tx_queue(struct data_queue *queue) |
1935 | const enum data_queue_qid qid) | ||
1936 | { | 1934 | { |
1935 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1937 | u32 reg; | 1936 | u32 reg; |
1938 | 1937 | ||
1939 | if (qid == QID_BEACON) { | 1938 | if (queue->qid == QID_BEACON) { |
1940 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0); | 1939 | rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0); |
1941 | return; | 1940 | return; |
1942 | } | 1941 | } |
1943 | 1942 | ||
1944 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); | 1943 | rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, ®); |
1945 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC0, (qid == QID_AC_BE)); | 1944 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC0, (queue->qid == QID_AC_BE)); |
1946 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC1, (qid == QID_AC_BK)); | 1945 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC1, (queue->qid == QID_AC_BK)); |
1947 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC2, (qid == QID_AC_VI)); | 1946 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC2, (queue->qid == QID_AC_VI)); |
1948 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC3, (qid == QID_AC_VO)); | 1947 | rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC3, (queue->qid == QID_AC_VO)); |
1949 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); | 1948 | rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg); |
1950 | } | 1949 | } |
1951 | 1950 | ||
@@ -2657,13 +2656,17 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2657 | spec->channels_info = info; | 2656 | spec->channels_info = info; |
2658 | 2657 | ||
2659 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); | 2658 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); |
2660 | for (i = 0; i < 14; i++) | 2659 | for (i = 0; i < 14; i++) { |
2661 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2660 | info[i].max_power = MAX_TXPOWER; |
2661 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2662 | } | ||
2662 | 2663 | ||
2663 | if (spec->num_channels > 14) { | 2664 | if (spec->num_channels > 14) { |
2664 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); | 2665 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); |
2665 | for (i = 14; i < spec->num_channels; i++) | 2666 | for (i = 14; i < spec->num_channels; i++) { |
2666 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2667 | info[i].max_power = MAX_TXPOWER; |
2668 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2669 | } | ||
2667 | } | 2670 | } |
2668 | 2671 | ||
2669 | return 0; | 2672 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 8ca19f70aea7..87fb2201537b 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1426,12 +1426,11 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1426 | /* | 1426 | /* |
1427 | * TX descriptor initialization | 1427 | * TX descriptor initialization |
1428 | */ | 1428 | */ |
1429 | static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1429 | static void rt73usb_write_tx_desc(struct queue_entry *entry, |
1430 | struct sk_buff *skb, | ||
1431 | struct txentry_desc *txdesc) | 1430 | struct txentry_desc *txdesc) |
1432 | { | 1431 | { |
1433 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1432 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1434 | __le32 *txd = (__le32 *) skb->data; | 1433 | __le32 *txd = (__le32 *) entry->skb->data; |
1435 | u32 word; | 1434 | u32 word; |
1436 | 1435 | ||
1437 | /* | 1436 | /* |
@@ -1464,7 +1463,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1464 | rt2x00_desc_write(txd, 0, word); | 1463 | rt2x00_desc_write(txd, 0, word); |
1465 | 1464 | ||
1466 | rt2x00_desc_read(txd, 1, &word); | 1465 | rt2x00_desc_read(txd, 1, &word); |
1467 | rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, txdesc->queue); | 1466 | rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, txdesc->qid); |
1468 | rt2x00_set_field32(&word, TXD_W1_AIFSN, txdesc->aifs); | 1467 | rt2x00_set_field32(&word, TXD_W1_AIFSN, txdesc->aifs); |
1469 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); | 1468 | rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); |
1470 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); | 1469 | rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); |
@@ -1487,7 +1486,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1487 | 1486 | ||
1488 | rt2x00_desc_read(txd, 5, &word); | 1487 | rt2x00_desc_read(txd, 5, &word); |
1489 | rt2x00_set_field32(&word, TXD_W5_TX_POWER, | 1488 | rt2x00_set_field32(&word, TXD_W5_TX_POWER, |
1490 | TXPOWER_TO_DEV(rt2x00dev->tx_power)); | 1489 | TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power)); |
1491 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); | 1490 | rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); |
1492 | rt2x00_desc_write(txd, 5, word); | 1491 | rt2x00_desc_write(txd, 5, word); |
1493 | 1492 | ||
@@ -1526,7 +1525,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry, | |||
1526 | /* | 1525 | /* |
1527 | * Write the TX descriptor for the beacon. | 1526 | * Write the TX descriptor for the beacon. |
1528 | */ | 1527 | */ |
1529 | rt73usb_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1528 | rt73usb_write_tx_desc(entry, txdesc); |
1530 | 1529 | ||
1531 | /* | 1530 | /* |
1532 | * Dump beacon to userspace through debugfs. | 1531 | * Dump beacon to userspace through debugfs. |
@@ -1574,6 +1573,14 @@ static int rt73usb_get_tx_data_len(struct queue_entry *entry) | |||
1574 | return length; | 1573 | return length; |
1575 | } | 1574 | } |
1576 | 1575 | ||
1576 | static void rt73usb_kill_tx_queue(struct data_queue *queue) | ||
1577 | { | ||
1578 | if (queue->qid == QID_BEACON) | ||
1579 | rt2x00usb_register_write(queue->rt2x00dev, TXRX_CSR9, 0); | ||
1580 | |||
1581 | rt2x00usb_kill_tx_queue(queue); | ||
1582 | } | ||
1583 | |||
1577 | /* | 1584 | /* |
1578 | * RX control handlers | 1585 | * RX control handlers |
1579 | */ | 1586 | */ |
@@ -2091,13 +2098,17 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2091 | spec->channels_info = info; | 2098 | spec->channels_info = info; |
2092 | 2099 | ||
2093 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); | 2100 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); |
2094 | for (i = 0; i < 14; i++) | 2101 | for (i = 0; i < 14; i++) { |
2095 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2102 | info[i].max_power = MAX_TXPOWER; |
2103 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2104 | } | ||
2096 | 2105 | ||
2097 | if (spec->num_channels > 14) { | 2106 | if (spec->num_channels > 14) { |
2098 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); | 2107 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); |
2099 | for (i = 14; i < spec->num_channels; i++) | 2108 | for (i = 14; i < spec->num_channels; i++) { |
2100 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2109 | info[i].max_power = MAX_TXPOWER; |
2110 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2111 | } | ||
2101 | } | 2112 | } |
2102 | 2113 | ||
2103 | return 0; | 2114 | return 0; |
@@ -2259,7 +2270,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2259 | .write_beacon = rt73usb_write_beacon, | 2270 | .write_beacon = rt73usb_write_beacon, |
2260 | .get_tx_data_len = rt73usb_get_tx_data_len, | 2271 | .get_tx_data_len = rt73usb_get_tx_data_len, |
2261 | .kick_tx_queue = rt2x00usb_kick_tx_queue, | 2272 | .kick_tx_queue = rt2x00usb_kick_tx_queue, |
2262 | .kill_tx_queue = rt2x00usb_kill_tx_queue, | 2273 | .kill_tx_queue = rt73usb_kill_tx_queue, |
2263 | .fill_rxdone = rt73usb_fill_rxdone, | 2274 | .fill_rxdone = rt73usb_fill_rxdone, |
2264 | .config_shared_key = rt73usb_config_shared_key, | 2275 | .config_shared_key = rt73usb_config_shared_key, |
2265 | .config_pairwise_key = rt73usb_config_pairwise_key, | 2276 | .config_pairwise_key = rt73usb_config_pairwise_key, |
diff --git a/drivers/net/wireless/wl12xx/wl1251.h b/drivers/net/wireless/wl12xx/wl1251.h index 6b942a28e6a5..e113d4c1fb35 100644 --- a/drivers/net/wireless/wl12xx/wl1251.h +++ b/drivers/net/wireless/wl12xx/wl1251.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008-2009 Nokia Corporation | 5 | * Copyright (C) 2008-2009 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
@@ -274,6 +272,8 @@ struct wl1251 { | |||
274 | int irq; | 272 | int irq; |
275 | bool use_eeprom; | 273 | bool use_eeprom; |
276 | 274 | ||
275 | spinlock_t wl_lock; | ||
276 | |||
277 | enum wl1251_state state; | 277 | enum wl1251_state state; |
278 | struct mutex mutex; | 278 | struct mutex mutex; |
279 | 279 | ||
@@ -401,7 +401,8 @@ void wl1251_disable_interrupts(struct wl1251 *wl); | |||
401 | 401 | ||
402 | #define WL1251_DEFAULT_POWER_LEVEL 20 | 402 | #define WL1251_DEFAULT_POWER_LEVEL 20 |
403 | 403 | ||
404 | #define WL1251_TX_QUEUE_MAX_LENGTH 20 | 404 | #define WL1251_TX_QUEUE_LOW_WATERMARK 10 |
405 | #define WL1251_TX_QUEUE_HIGH_WATERMARK 25 | ||
405 | 406 | ||
406 | #define WL1251_DEFAULT_BEACON_INT 100 | 407 | #define WL1251_DEFAULT_BEACON_INT 100 |
407 | #define WL1251_DEFAULT_DTIM_PERIOD 1 | 408 | #define WL1251_DEFAULT_DTIM_PERIOD 1 |
diff --git a/drivers/net/wireless/wl12xx/wl1251_acx.h b/drivers/net/wireless/wl12xx/wl1251_acx.h index a8845b8f2451..c7cc5c1e8a75 100644 --- a/drivers/net/wireless/wl12xx/wl1251_acx.h +++ b/drivers/net/wireless/wl12xx/wl1251_acx.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c index 5e65f47fda8a..468b47b0328a 100644 --- a/drivers/net/wireless/wl12xx/wl1251_boot.c +++ b/drivers/net/wireless/wl12xx/wl1251_boot.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.h b/drivers/net/wireless/wl12xx/wl1251_boot.h index 90063697e8f2..7661bc5e4662 100644 --- a/drivers/net/wireless/wl12xx/wl1251_boot.h +++ b/drivers/net/wireless/wl12xx/wl1251_boot.h | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.h b/drivers/net/wireless/wl12xx/wl1251_cmd.h index 60d7e522486c..e5c74c631374 100644 --- a/drivers/net/wireless/wl12xx/wl1251_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1251_cmd.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.c b/drivers/net/wireless/wl12xx/wl1251_debugfs.c index 5e4465ac08fa..6ffe4cd58561 100644 --- a/drivers/net/wireless/wl12xx/wl1251_debugfs.c +++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.h b/drivers/net/wireless/wl12xx/wl1251_debugfs.h index 6dc3d080853c..b3417c02a218 100644 --- a/drivers/net/wireless/wl12xx/wl1251_debugfs.h +++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.h | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_event.c b/drivers/net/wireless/wl12xx/wl1251_event.c index e093a1c5a205..54223556b308 100644 --- a/drivers/net/wireless/wl12xx/wl1251_event.c +++ b/drivers/net/wireless/wl12xx/wl1251_event.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
@@ -36,9 +34,7 @@ static int wl1251_event_scan_complete(struct wl1251 *wl, | |||
36 | mbox->scheduled_scan_channels); | 34 | mbox->scheduled_scan_channels); |
37 | 35 | ||
38 | if (wl->scanning) { | 36 | if (wl->scanning) { |
39 | mutex_unlock(&wl->mutex); | ||
40 | ieee80211_scan_completed(wl->hw, false); | 37 | ieee80211_scan_completed(wl->hw, false); |
41 | mutex_lock(&wl->mutex); | ||
42 | wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan completed"); | 38 | wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan completed"); |
43 | wl->scanning = false; | 39 | wl->scanning = false; |
44 | } | 40 | } |
diff --git a/drivers/net/wireless/wl12xx/wl1251_event.h b/drivers/net/wireless/wl12xx/wl1251_event.h index ec456474a842..30eb5d150bf7 100644 --- a/drivers/net/wireless/wl12xx/wl1251_event.h +++ b/drivers/net/wireless/wl12xx/wl1251_event.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_init.c b/drivers/net/wireless/wl12xx/wl1251_init.c index b538bdd7b320..c5daec05d9ee 100644 --- a/drivers/net/wireless/wl12xx/wl1251_init.c +++ b/drivers/net/wireless/wl12xx/wl1251_init.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_init.h b/drivers/net/wireless/wl12xx/wl1251_init.h index 269cefb3e7d4..543f17582ead 100644 --- a/drivers/net/wireless/wl12xx/wl1251_init.h +++ b/drivers/net/wireless/wl12xx/wl1251_init.h | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_io.c b/drivers/net/wireless/wl12xx/wl1251_io.c index f1c232e0887f..ad6ca68b303f 100644 --- a/drivers/net/wireless/wl12xx/wl1251_io.c +++ b/drivers/net/wireless/wl12xx/wl1251_io.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c index c81e95b45c14..faf221ca3f41 100644 --- a/drivers/net/wireless/wl12xx/wl1251_main.c +++ b/drivers/net/wireless/wl12xx/wl1251_main.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008-2009 Nokia Corporation | 4 | * Copyright (C) 2008-2009 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
@@ -377,6 +375,7 @@ out: | |||
377 | static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 375 | static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
378 | { | 376 | { |
379 | struct wl1251 *wl = hw->priv; | 377 | struct wl1251 *wl = hw->priv; |
378 | unsigned long flags; | ||
380 | 379 | ||
381 | skb_queue_tail(&wl->tx_queue, skb); | 380 | skb_queue_tail(&wl->tx_queue, skb); |
382 | 381 | ||
@@ -391,16 +390,13 @@ static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
391 | * The workqueue is slow to process the tx_queue and we need stop | 390 | * The workqueue is slow to process the tx_queue and we need stop |
392 | * the queue here, otherwise the queue will get too long. | 391 | * the queue here, otherwise the queue will get too long. |
393 | */ | 392 | */ |
394 | if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_MAX_LENGTH) { | 393 | if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_HIGH_WATERMARK) { |
395 | wl1251_debug(DEBUG_TX, "op_tx: tx_queue full, stop queues"); | 394 | wl1251_debug(DEBUG_TX, "op_tx: tx_queue full, stop queues"); |
396 | ieee80211_stop_queues(wl->hw); | ||
397 | 395 | ||
398 | /* | 396 | spin_lock_irqsave(&wl->wl_lock, flags); |
399 | * FIXME: this is racy, the variable is not properly | 397 | ieee80211_stop_queues(wl->hw); |
400 | * protected. Maybe fix this by removing the stupid | ||
401 | * variable altogether and checking the real queue state? | ||
402 | */ | ||
403 | wl->tx_queue_stopped = true; | 398 | wl->tx_queue_stopped = true; |
399 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
404 | } | 400 | } |
405 | 401 | ||
406 | return NETDEV_TX_OK; | 402 | return NETDEV_TX_OK; |
@@ -469,9 +465,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
469 | WARN_ON(wl->state != WL1251_STATE_ON); | 465 | WARN_ON(wl->state != WL1251_STATE_ON); |
470 | 466 | ||
471 | if (wl->scanning) { | 467 | if (wl->scanning) { |
472 | mutex_unlock(&wl->mutex); | ||
473 | ieee80211_scan_completed(wl->hw, true); | 468 | ieee80211_scan_completed(wl->hw, true); |
474 | mutex_lock(&wl->mutex); | ||
475 | wl->scanning = false; | 469 | wl->scanning = false; |
476 | } | 470 | } |
477 | 471 | ||
@@ -1437,5 +1431,5 @@ EXPORT_SYMBOL_GPL(wl1251_free_hw); | |||
1437 | 1431 | ||
1438 | MODULE_DESCRIPTION("TI wl1251 Wireles LAN Driver Core"); | 1432 | MODULE_DESCRIPTION("TI wl1251 Wireles LAN Driver Core"); |
1439 | MODULE_LICENSE("GPL"); | 1433 | MODULE_LICENSE("GPL"); |
1440 | MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>"); | 1434 | MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>"); |
1441 | MODULE_FIRMWARE(WL1251_FW_NAME); | 1435 | MODULE_FIRMWARE(WL1251_FW_NAME); |
diff --git a/drivers/net/wireless/wl12xx/wl1251_ps.c b/drivers/net/wireless/wl12xx/wl1251_ps.c index b55cb2bd459a..0b997bdfec09 100644 --- a/drivers/net/wireless/wl12xx/wl1251_ps.c +++ b/drivers/net/wireless/wl12xx/wl1251_ps.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_ps.h b/drivers/net/wireless/wl12xx/wl1251_ps.h index c688ac57aee4..e5db81fc1dfc 100644 --- a/drivers/net/wireless/wl12xx/wl1251_ps.h +++ b/drivers/net/wireless/wl12xx/wl1251_ps.h | |||
@@ -1,14 +1,9 @@ | |||
1 | #ifndef __WL1251_PS_H__ | ||
2 | #define __WL1251_PS_H__ | ||
3 | |||
4 | /* | 1 | /* |
5 | * This file is part of wl1251 | 2 | * This file is part of wl1251 |
6 | * | 3 | * |
7 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
8 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
9 | * | 6 | * |
10 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
14 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
@@ -25,6 +20,9 @@ | |||
25 | * | 20 | * |
26 | */ | 21 | */ |
27 | 22 | ||
23 | #ifndef __WL1251_PS_H__ | ||
24 | #define __WL1251_PS_H__ | ||
25 | |||
28 | #include "wl1251.h" | 26 | #include "wl1251.h" |
29 | #include "wl1251_acx.h" | 27 | #include "wl1251_acx.h" |
30 | 28 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1251_reg.h b/drivers/net/wireless/wl12xx/wl1251_reg.h index d16edd9bf06c..a5809019c5c1 100644 --- a/drivers/net/wireless/wl12xx/wl1251_reg.h +++ b/drivers/net/wireless/wl12xx/wl1251_reg.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.c b/drivers/net/wireless/wl12xx/wl1251_rx.c index 1b6294b3b996..25764592a596 100644 --- a/drivers/net/wireless/wl12xx/wl1251_rx.c +++ b/drivers/net/wireless/wl12xx/wl1251_rx.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_rx.h b/drivers/net/wireless/wl12xx/wl1251_rx.h index da4e53406a0e..4448f635a4d8 100644 --- a/drivers/net/wireless/wl12xx/wl1251_rx.h +++ b/drivers/net/wireless/wl12xx/wl1251_rx.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c index b901b6135654..c0b68b0a9aa8 100644 --- a/drivers/net/wireless/wl12xx/wl1251_sdio.c +++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c | |||
@@ -339,4 +339,4 @@ module_init(wl1251_sdio_init); | |||
339 | module_exit(wl1251_sdio_exit); | 339 | module_exit(wl1251_sdio_exit); |
340 | 340 | ||
341 | MODULE_LICENSE("GPL"); | 341 | MODULE_LICENSE("GPL"); |
342 | MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>"); | 342 | MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>"); |
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c index 27fdfaaeb074..334ded9881c0 100644 --- a/drivers/net/wireless/wl12xx/wl1251_spi.c +++ b/drivers/net/wireless/wl12xx/wl1251_spi.c | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2008 Nokia Corporation | 4 | * Copyright (C) 2008 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 8 | * version 2 as published by the Free Software Foundation. |
@@ -344,5 +342,5 @@ module_init(wl1251_spi_init); | |||
344 | module_exit(wl1251_spi_exit); | 342 | module_exit(wl1251_spi_exit); |
345 | 343 | ||
346 | MODULE_LICENSE("GPL"); | 344 | MODULE_LICENSE("GPL"); |
347 | MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>"); | 345 | MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>"); |
348 | MODULE_ALIAS("spi:wl1251"); | 346 | MODULE_ALIAS("spi:wl1251"); |
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.h b/drivers/net/wireless/wl12xx/wl1251_spi.h index 2e273a97e7f3..7dcf3cf7ae40 100644 --- a/drivers/net/wireless/wl12xx/wl1251_spi.h +++ b/drivers/net/wireless/wl12xx/wl1251_spi.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.c b/drivers/net/wireless/wl12xx/wl1251_tx.c index 6634b3e27cfc..388492a7f41f 100644 --- a/drivers/net/wireless/wl12xx/wl1251_tx.c +++ b/drivers/net/wireless/wl12xx/wl1251_tx.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
@@ -322,11 +320,6 @@ void wl1251_tx_work(struct work_struct *work) | |||
322 | 320 | ||
323 | ret = wl1251_tx_frame(wl, skb); | 321 | ret = wl1251_tx_frame(wl, skb); |
324 | if (ret == -EBUSY) { | 322 | if (ret == -EBUSY) { |
325 | /* firmware buffer is full, stop queues */ | ||
326 | wl1251_debug(DEBUG_TX, "tx_work: fw buffer full, " | ||
327 | "stop queues"); | ||
328 | ieee80211_stop_queues(wl->hw); | ||
329 | wl->tx_queue_stopped = true; | ||
330 | skb_queue_head(&wl->tx_queue, skb); | 323 | skb_queue_head(&wl->tx_queue, skb); |
331 | goto out; | 324 | goto out; |
332 | } else if (ret < 0) { | 325 | } else if (ret < 0) { |
@@ -449,6 +442,7 @@ void wl1251_tx_complete(struct wl1251 *wl) | |||
449 | { | 442 | { |
450 | int i, result_index, num_complete = 0; | 443 | int i, result_index, num_complete = 0; |
451 | struct tx_result result[FW_TX_CMPLT_BLOCK_SIZE], *result_ptr; | 444 | struct tx_result result[FW_TX_CMPLT_BLOCK_SIZE], *result_ptr; |
445 | unsigned long flags; | ||
452 | 446 | ||
453 | if (unlikely(wl->state != WL1251_STATE_ON)) | 447 | if (unlikely(wl->state != WL1251_STATE_ON)) |
454 | return; | 448 | return; |
@@ -477,6 +471,20 @@ void wl1251_tx_complete(struct wl1251 *wl) | |||
477 | } | 471 | } |
478 | } | 472 | } |
479 | 473 | ||
474 | if (wl->tx_queue_stopped | ||
475 | && | ||
476 | skb_queue_len(&wl->tx_queue) <= WL1251_TX_QUEUE_LOW_WATERMARK){ | ||
477 | |||
478 | /* firmware buffer has space, restart queues */ | ||
479 | wl1251_debug(DEBUG_TX, "tx_complete: waking queues"); | ||
480 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
481 | ieee80211_wake_queues(wl->hw); | ||
482 | wl->tx_queue_stopped = false; | ||
483 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
484 | ieee80211_queue_work(wl->hw, &wl->tx_work); | ||
485 | |||
486 | } | ||
487 | |||
480 | /* Every completed frame needs to be acknowledged */ | 488 | /* Every completed frame needs to be acknowledged */ |
481 | if (num_complete) { | 489 | if (num_complete) { |
482 | /* | 490 | /* |
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.h b/drivers/net/wireless/wl12xx/wl1251_tx.h index f40eeb37f5aa..96011e78cd5a 100644 --- a/drivers/net/wireless/wl12xx/wl1251_tx.h +++ b/drivers/net/wireless/wl12xx/wl1251_tx.h | |||
@@ -4,8 +4,6 @@ | |||
4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated | 4 | * Copyright (c) 1998-2007 Texas Instruments Incorporated |
5 | * Copyright (C) 2008 Nokia Corporation | 5 | * Copyright (C) 2008 Nokia Corporation |
6 | * | 6 | * |
7 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
11 | * version 2 as published by the Free Software Foundation. | 9 | * version 2 as published by the Free Software Foundation. |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 30194c0f36a9..8e55cf8d509d 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -948,9 +948,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
948 | ieee80211_enable_dyn_ps(wl->vif); | 948 | ieee80211_enable_dyn_ps(wl->vif); |
949 | 949 | ||
950 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { | 950 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { |
951 | mutex_unlock(&wl->mutex); | ||
952 | ieee80211_scan_completed(wl->hw, true); | 951 | ieee80211_scan_completed(wl->hw, true); |
953 | mutex_lock(&wl->mutex); | ||
954 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | 952 | wl->scan.state = WL1271_SCAN_STATE_IDLE; |
955 | kfree(wl->scan.scanned_ch); | 953 | kfree(wl->scan.scanned_ch); |
956 | wl->scan.scanned_ch = NULL; | 954 | wl->scan.scanned_ch = NULL; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.c b/drivers/net/wireless/wl12xx/wl1271_scan.c index 30dc1000f563..e4950c8e396e 100644 --- a/drivers/net/wireless/wl12xx/wl1271_scan.c +++ b/drivers/net/wireless/wl12xx/wl1271_scan.c | |||
@@ -215,9 +215,7 @@ void wl1271_scan_stm(struct wl1271 *wl) | |||
215 | break; | 215 | break; |
216 | 216 | ||
217 | case WL1271_SCAN_STATE_DONE: | 217 | case WL1271_SCAN_STATE_DONE: |
218 | mutex_unlock(&wl->mutex); | ||
219 | ieee80211_scan_completed(wl->hw, false); | 218 | ieee80211_scan_completed(wl->hw, false); |
220 | mutex_lock(&wl->mutex); | ||
221 | 219 | ||
222 | kfree(wl->scan.scanned_ch); | 220 | kfree(wl->scan.scanned_ch); |
223 | wl->scan.scanned_ch = NULL; | 221 | wl->scan.scanned_ch = NULL; |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index ec1690da7845..31603e8b5581 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -295,7 +295,9 @@ | |||
295 | * auth and assoc steps. For this, you need to specify the SSID in a | 295 | * auth and assoc steps. For this, you need to specify the SSID in a |
296 | * %NL80211_ATTR_SSID attribute, and can optionally specify the association | 296 | * %NL80211_ATTR_SSID attribute, and can optionally specify the association |
297 | * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, | 297 | * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, |
298 | * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT. | 298 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, |
299 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and | ||
300 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. | ||
299 | * It is also sent as an event, with the BSSID and response IEs when the | 301 | * It is also sent as an event, with the BSSID and response IEs when the |
300 | * connection is established or failed to be established. This can be | 302 | * connection is established or failed to be established. This can be |
301 | * determined by the STATUS_CODE attribute. | 303 | * determined by the STATUS_CODE attribute. |
@@ -686,6 +688,15 @@ enum nl80211_commands { | |||
686 | * request, the driver will assume that the port is unauthorized until | 688 | * request, the driver will assume that the port is unauthorized until |
687 | * authorized by user space. Otherwise, port is marked authorized by | 689 | * authorized by user space. Otherwise, port is marked authorized by |
688 | * default in station mode. | 690 | * default in station mode. |
691 | * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the | ||
692 | * ethertype that will be used for key negotiation. It can be | ||
693 | * specified with the associate and connect commands. If it is not | ||
694 | * specified, the value defaults to 0x888E (PAE, 802.1X). This | ||
695 | * attribute is also used as a flag in the wiphy information to | ||
696 | * indicate that protocols other than PAE are supported. | ||
697 | * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with | ||
698 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom | ||
699 | * ethertype frames used for key negotiation must not be encrypted. | ||
689 | * | 700 | * |
690 | * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. | 701 | * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. |
691 | * We recommend using nested, driver-specific attributes within this. | 702 | * We recommend using nested, driver-specific attributes within this. |
@@ -951,6 +962,9 @@ enum nl80211_attrs { | |||
951 | NL80211_ATTR_RX_FRAME_TYPES, | 962 | NL80211_ATTR_RX_FRAME_TYPES, |
952 | NL80211_ATTR_FRAME_TYPE, | 963 | NL80211_ATTR_FRAME_TYPE, |
953 | 964 | ||
965 | NL80211_ATTR_CONTROL_PORT_ETHERTYPE, | ||
966 | NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, | ||
967 | |||
954 | /* add attributes here, update the policy in nl80211.c */ | 968 | /* add attributes here, update the policy in nl80211.c */ |
955 | 969 | ||
956 | __NL80211_ATTR_AFTER_LAST, | 970 | __NL80211_ATTR_AFTER_LAST, |
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h index a223ecbc71ef..a20bccf0b5c2 100644 --- a/include/linux/spi/wl12xx.h +++ b/include/linux/spi/wl12xx.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | 6 | * Contact: Luciano Coelho <luciano.coelho@nokia.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 9 | * modify it under the terms of the GNU General Public License |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f2740537b5d6..4c8c727d0cca 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -763,6 +763,10 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); | |||
763 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | 763 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is |
764 | * required to assume that the port is unauthorized until authorized by | 764 | * required to assume that the port is unauthorized until authorized by |
765 | * user space. Otherwise, port is marked authorized by default. | 765 | * user space. Otherwise, port is marked authorized by default. |
766 | * @control_port_ethertype: the control port protocol that should be | ||
767 | * allowed through even on unauthorized ports | ||
768 | * @control_port_no_encrypt: TRUE to prevent encryption of control port | ||
769 | * protocol frames. | ||
766 | */ | 770 | */ |
767 | struct cfg80211_crypto_settings { | 771 | struct cfg80211_crypto_settings { |
768 | u32 wpa_versions; | 772 | u32 wpa_versions; |
@@ -772,6 +776,8 @@ struct cfg80211_crypto_settings { | |||
772 | int n_akm_suites; | 776 | int n_akm_suites; |
773 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; | 777 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; |
774 | bool control_port; | 778 | bool control_port; |
779 | __be16 control_port_ethertype; | ||
780 | bool control_port_no_encrypt; | ||
775 | }; | 781 | }; |
776 | 782 | ||
777 | /** | 783 | /** |
@@ -1293,15 +1299,19 @@ struct cfg80211_ops { | |||
1293 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station | 1299 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station |
1294 | * on a VLAN interface) | 1300 | * on a VLAN interface) |
1295 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station | 1301 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station |
1302 | * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the | ||
1303 | * control port protocol ethertype. The device also honours the | ||
1304 | * control_port_no_encrypt flag. | ||
1296 | */ | 1305 | */ |
1297 | enum wiphy_flags { | 1306 | enum wiphy_flags { |
1298 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1307 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
1299 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), | 1308 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), |
1300 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), | 1309 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), |
1301 | WIPHY_FLAG_NETNS_OK = BIT(3), | 1310 | WIPHY_FLAG_NETNS_OK = BIT(3), |
1302 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), | 1311 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), |
1303 | WIPHY_FLAG_4ADDR_AP = BIT(5), | 1312 | WIPHY_FLAG_4ADDR_AP = BIT(5), |
1304 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 1313 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
1314 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | ||
1305 | }; | 1315 | }; |
1306 | 1316 | ||
1307 | struct mac_address { | 1317 | struct mac_address { |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 2a1811366076..f91fc331369b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1242,8 +1242,8 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1242 | * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in | 1242 | * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in |
1243 | * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused | 1243 | * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused |
1244 | * with hardware wakeup and sleep states. Driver is responsible for waking | 1244 | * with hardware wakeup and sleep states. Driver is responsible for waking |
1245 | * up the hardware before issueing commands to the hardware and putting it | 1245 | * up the hardware before issuing commands to the hardware and putting it |
1246 | * back to sleep at approriate times. | 1246 | * back to sleep at appropriate times. |
1247 | * | 1247 | * |
1248 | * When PS is enabled, hardware needs to wakeup for beacons and receive the | 1248 | * When PS is enabled, hardware needs to wakeup for beacons and receive the |
1249 | * buffered multicast/broadcast frames after the beacon. Also it must be | 1249 | * buffered multicast/broadcast frames after the beacon. Also it must be |
@@ -1264,7 +1264,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
1264 | * there's data traffic and still saving significantly power in idle | 1264 | * there's data traffic and still saving significantly power in idle |
1265 | * periods. | 1265 | * periods. |
1266 | * | 1266 | * |
1267 | * Dynamic powersave is supported by simply mac80211 enabling and disabling | 1267 | * Dynamic powersave is simply supported by mac80211 enabling and disabling |
1268 | * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS | 1268 | * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS |
1269 | * flag and mac80211 will handle everything automatically. Additionally, | 1269 | * flag and mac80211 will handle everything automatically. Additionally, |
1270 | * hardware having support for the dynamic PS feature may set the | 1270 | * hardware having support for the dynamic PS feature may set the |
@@ -1537,6 +1537,12 @@ enum ieee80211_ampdu_mlme_action { | |||
1537 | * negative error code (which will be seen in userspace.) | 1537 | * negative error code (which will be seen in userspace.) |
1538 | * Must be implemented and can sleep. | 1538 | * Must be implemented and can sleep. |
1539 | * | 1539 | * |
1540 | * @change_interface: Called when a netdevice changes type. This callback | ||
1541 | * is optional, but only if it is supported can interface types be | ||
1542 | * switched while the interface is UP. The callback may sleep. | ||
1543 | * Note that while an interface is being switched, it will not be | ||
1544 | * found by the interface iteration callbacks. | ||
1545 | * | ||
1540 | * @remove_interface: Notifies a driver that an interface is going down. | 1546 | * @remove_interface: Notifies a driver that an interface is going down. |
1541 | * The @stop callback is called after this if it is the last interface | 1547 | * The @stop callback is called after this if it is the last interface |
1542 | * and no monitor interfaces are present. | 1548 | * and no monitor interfaces are present. |
@@ -1693,6 +1699,9 @@ struct ieee80211_ops { | |||
1693 | void (*stop)(struct ieee80211_hw *hw); | 1699 | void (*stop)(struct ieee80211_hw *hw); |
1694 | int (*add_interface)(struct ieee80211_hw *hw, | 1700 | int (*add_interface)(struct ieee80211_hw *hw, |
1695 | struct ieee80211_vif *vif); | 1701 | struct ieee80211_vif *vif); |
1702 | int (*change_interface)(struct ieee80211_hw *hw, | ||
1703 | struct ieee80211_vif *vif, | ||
1704 | enum nl80211_iftype new_type); | ||
1696 | void (*remove_interface)(struct ieee80211_hw *hw, | 1705 | void (*remove_interface)(struct ieee80211_hw *hw, |
1697 | struct ieee80211_vif *vif); | 1706 | struct ieee80211_vif *vif); |
1698 | int (*config)(struct ieee80211_hw *hw, u32 changed); | 1707 | int (*config)(struct ieee80211_hw *hw, u32 changed); |
@@ -2268,7 +2277,8 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw); | |||
2268 | * | 2277 | * |
2269 | * When hardware scan offload is used (i.e. the hw_scan() callback is | 2278 | * When hardware scan offload is used (i.e. the hw_scan() callback is |
2270 | * assigned) this function needs to be called by the driver to notify | 2279 | * assigned) this function needs to be called by the driver to notify |
2271 | * mac80211 that the scan finished. | 2280 | * mac80211 that the scan finished. This function can be called from |
2281 | * any context, including hardirq context. | ||
2272 | * | 2282 | * |
2273 | * @hw: the hardware that finished the scan | 2283 | * @hw: the hardware that finished the scan |
2274 | * @aborted: set to true if scan was aborted | 2284 | * @aborted: set to true if scan was aborted |
@@ -2458,7 +2468,7 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
2458 | * | 2468 | * |
2459 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2469 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
2460 | * | 2470 | * |
2461 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and | 2471 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and |
2462 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 2472 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
2463 | * hardware is not receiving beacons with this function. | 2473 | * hardware is not receiving beacons with this function. |
2464 | */ | 2474 | */ |
@@ -2469,7 +2479,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif); | |||
2469 | * | 2479 | * |
2470 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2480 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
2471 | * | 2481 | * |
2472 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and | 2482 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and |
2473 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver | 2483 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver |
2474 | * needs to inform if the connection to the AP has been lost. | 2484 | * needs to inform if the connection to the AP has been lost. |
2475 | * | 2485 | * |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 94787d21282c..5de1ca3f17b9 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -19,33 +19,6 @@ | |||
19 | #include "rate.h" | 19 | #include "rate.h" |
20 | #include "mesh.h" | 20 | #include "mesh.h" |
21 | 21 | ||
22 | static bool nl80211_type_check(enum nl80211_iftype type) | ||
23 | { | ||
24 | switch (type) { | ||
25 | case NL80211_IFTYPE_ADHOC: | ||
26 | case NL80211_IFTYPE_STATION: | ||
27 | case NL80211_IFTYPE_MONITOR: | ||
28 | #ifdef CONFIG_MAC80211_MESH | ||
29 | case NL80211_IFTYPE_MESH_POINT: | ||
30 | #endif | ||
31 | case NL80211_IFTYPE_AP: | ||
32 | case NL80211_IFTYPE_AP_VLAN: | ||
33 | case NL80211_IFTYPE_WDS: | ||
34 | return true; | ||
35 | default: | ||
36 | return false; | ||
37 | } | ||
38 | } | ||
39 | |||
40 | static bool nl80211_params_check(enum nl80211_iftype type, | ||
41 | struct vif_params *params) | ||
42 | { | ||
43 | if (!nl80211_type_check(type)) | ||
44 | return false; | ||
45 | |||
46 | return true; | ||
47 | } | ||
48 | |||
49 | static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | 22 | static int ieee80211_add_iface(struct wiphy *wiphy, char *name, |
50 | enum nl80211_iftype type, u32 *flags, | 23 | enum nl80211_iftype type, u32 *flags, |
51 | struct vif_params *params) | 24 | struct vif_params *params) |
@@ -55,9 +28,6 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
55 | struct ieee80211_sub_if_data *sdata; | 28 | struct ieee80211_sub_if_data *sdata; |
56 | int err; | 29 | int err; |
57 | 30 | ||
58 | if (!nl80211_params_check(type, params)) | ||
59 | return -EINVAL; | ||
60 | |||
61 | err = ieee80211_if_add(local, name, &dev, type, params); | 31 | err = ieee80211_if_add(local, name, &dev, type, params); |
62 | if (err || type != NL80211_IFTYPE_MONITOR || !flags) | 32 | if (err || type != NL80211_IFTYPE_MONITOR || !flags) |
63 | return err; | 33 | return err; |
@@ -82,12 +52,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
82 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 52 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
83 | int ret; | 53 | int ret; |
84 | 54 | ||
85 | if (ieee80211_sdata_running(sdata)) | ||
86 | return -EBUSY; | ||
87 | |||
88 | if (!nl80211_params_check(type, params)) | ||
89 | return -EINVAL; | ||
90 | |||
91 | ret = ieee80211_if_change_type(sdata, type); | 55 | ret = ieee80211_if_change_type(sdata, type); |
92 | if (ret) | 56 | if (ret) |
93 | return ret; | 57 | return ret; |
@@ -114,16 +78,14 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
114 | u8 key_idx, const u8 *mac_addr, | 78 | u8 key_idx, const u8 *mac_addr, |
115 | struct key_params *params) | 79 | struct key_params *params) |
116 | { | 80 | { |
117 | struct ieee80211_sub_if_data *sdata; | 81 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
118 | struct sta_info *sta = NULL; | 82 | struct sta_info *sta = NULL; |
119 | struct ieee80211_key *key; | 83 | struct ieee80211_key *key; |
120 | int err; | 84 | int err; |
121 | 85 | ||
122 | if (!netif_running(dev)) | 86 | if (!ieee80211_sdata_running(sdata)) |
123 | return -ENETDOWN; | 87 | return -ENETDOWN; |
124 | 88 | ||
125 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
126 | |||
127 | /* reject WEP and TKIP keys if WEP failed to initialize */ | 89 | /* reject WEP and TKIP keys if WEP failed to initialize */ |
128 | switch (params->cipher) { | 90 | switch (params->cipher) { |
129 | case WLAN_CIPHER_SUITE_WEP40: | 91 | case WLAN_CIPHER_SUITE_WEP40: |
@@ -152,9 +114,10 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
152 | } | 114 | } |
153 | } | 115 | } |
154 | 116 | ||
155 | ieee80211_key_link(key, sdata, sta); | 117 | err = ieee80211_key_link(key, sdata, sta); |
118 | if (err) | ||
119 | ieee80211_key_free(sdata->local, key); | ||
156 | 120 | ||
157 | err = 0; | ||
158 | out_unlock: | 121 | out_unlock: |
159 | mutex_unlock(&sdata->local->sta_mtx); | 122 | mutex_unlock(&sdata->local->sta_mtx); |
160 | 123 | ||
@@ -1123,9 +1086,9 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy, | |||
1123 | p.uapsd = false; | 1086 | p.uapsd = false; |
1124 | 1087 | ||
1125 | if (drv_conf_tx(local, params->queue, &p)) { | 1088 | if (drv_conf_tx(local, params->queue, &p)) { |
1126 | printk(KERN_DEBUG "%s: failed to set TX queue " | 1089 | wiphy_debug(local->hw.wiphy, |
1127 | "parameters for queue %d\n", | 1090 | "failed to set TX queue parameters for queue %d\n", |
1128 | wiphy_name(local->hw.wiphy), params->queue); | 1091 | params->queue); |
1129 | return -EINVAL; | 1092 | return -EINVAL; |
1130 | } | 1093 | } |
1131 | 1094 | ||
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index a694c593ff6a..e81ef4e8cb32 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -85,13 +85,15 @@ static ssize_t tsf_write(struct file *file, | |||
85 | if (strncmp(buf, "reset", 5) == 0) { | 85 | if (strncmp(buf, "reset", 5) == 0) { |
86 | if (local->ops->reset_tsf) { | 86 | if (local->ops->reset_tsf) { |
87 | drv_reset_tsf(local); | 87 | drv_reset_tsf(local); |
88 | printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy)); | 88 | wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); |
89 | } | 89 | } |
90 | } else { | 90 | } else { |
91 | tsf = simple_strtoul(buf, NULL, 0); | 91 | tsf = simple_strtoul(buf, NULL, 0); |
92 | if (local->ops->set_tsf) { | 92 | if (local->ops->set_tsf) { |
93 | drv_set_tsf(local, tsf); | 93 | drv_set_tsf(local, tsf); |
94 | printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf); | 94 | wiphy_info(local->hw.wiphy, |
95 | "debugfs set TSF to %#018llx\n", tsf); | ||
96 | |||
95 | } | 97 | } |
96 | } | 98 | } |
97 | 99 | ||
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 14123dce544b..6064b7b09e01 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -54,6 +54,20 @@ static inline int drv_add_interface(struct ieee80211_local *local, | |||
54 | return ret; | 54 | return ret; |
55 | } | 55 | } |
56 | 56 | ||
57 | static inline int drv_change_interface(struct ieee80211_local *local, | ||
58 | struct ieee80211_sub_if_data *sdata, | ||
59 | enum nl80211_iftype type) | ||
60 | { | ||
61 | int ret; | ||
62 | |||
63 | might_sleep(); | ||
64 | |||
65 | trace_drv_change_interface(local, sdata, type); | ||
66 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type); | ||
67 | trace_drv_return_int(local, ret); | ||
68 | return ret; | ||
69 | } | ||
70 | |||
57 | static inline void drv_remove_interface(struct ieee80211_local *local, | 71 | static inline void drv_remove_interface(struct ieee80211_local *local, |
58 | struct ieee80211_vif *vif) | 72 | struct ieee80211_vif *vif) |
59 | { | 73 | { |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index b5a95582d816..f6f3d89e43fa 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -136,6 +136,31 @@ TRACE_EVENT(drv_add_interface, | |||
136 | ) | 136 | ) |
137 | ); | 137 | ); |
138 | 138 | ||
139 | TRACE_EVENT(drv_change_interface, | ||
140 | TP_PROTO(struct ieee80211_local *local, | ||
141 | struct ieee80211_sub_if_data *sdata, | ||
142 | enum nl80211_iftype type), | ||
143 | |||
144 | TP_ARGS(local, sdata, type), | ||
145 | |||
146 | TP_STRUCT__entry( | ||
147 | LOCAL_ENTRY | ||
148 | VIF_ENTRY | ||
149 | __field(u32, new_type) | ||
150 | ), | ||
151 | |||
152 | TP_fast_assign( | ||
153 | LOCAL_ASSIGN; | ||
154 | VIF_ASSIGN; | ||
155 | __entry->new_type = type; | ||
156 | ), | ||
157 | |||
158 | TP_printk( | ||
159 | LOCAL_PR_FMT VIF_PR_FMT " new type:%d", | ||
160 | LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type | ||
161 | ) | ||
162 | ); | ||
163 | |||
139 | TRACE_EVENT(drv_remove_interface, | 164 | TRACE_EVENT(drv_remove_interface, |
140 | TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata), | 165 | TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata), |
141 | 166 | ||
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 32af97108425..1a3aae54f0cf 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -427,8 +427,8 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
427 | return NULL; | 427 | return NULL; |
428 | 428 | ||
429 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 429 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
430 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", | 430 | wiphy_debug(local->hw.wiphy, "Adding new IBSS station %pM (dev=%s)\n", |
431 | wiphy_name(local->hw.wiphy), addr, sdata->name); | 431 | addr, sdata->name); |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | sta = sta_info_alloc(sdata, addr, gfp); | 434 | sta = sta_info_alloc(sdata, addr, gfp); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index e73ae51dc036..4e635e2fabdb 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -50,12 +50,6 @@ struct ieee80211_local; | |||
50 | * increased memory use (about 2 kB of RAM per entry). */ | 50 | * increased memory use (about 2 kB of RAM per entry). */ |
51 | #define IEEE80211_FRAGMENT_MAX 4 | 51 | #define IEEE80211_FRAGMENT_MAX 4 |
52 | 52 | ||
53 | /* | ||
54 | * Time after which we ignore scan results and no longer report/use | ||
55 | * them in any way. | ||
56 | */ | ||
57 | #define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ) | ||
58 | |||
59 | #define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024)) | 53 | #define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024)) |
60 | 54 | ||
61 | #define IEEE80211_DEFAULT_UAPSD_QUEUES \ | 55 | #define IEEE80211_DEFAULT_UAPSD_QUEUES \ |
@@ -375,6 +369,13 @@ struct ieee80211_if_managed { | |||
375 | int ave_beacon_signal; | 369 | int ave_beacon_signal; |
376 | 370 | ||
377 | /* | 371 | /* |
372 | * Number of Beacon frames used in ave_beacon_signal. This can be used | ||
373 | * to avoid generating less reliable cqm events that would be based | ||
374 | * only on couple of received frames. | ||
375 | */ | ||
376 | unsigned int count_beacon_signal; | ||
377 | |||
378 | /* | ||
378 | * Last Beacon frame signal strength average (ave_beacon_signal / 16) | 379 | * Last Beacon frame signal strength average (ave_beacon_signal / 16) |
379 | * that triggered a cqm event. 0 indicates that no event has been | 380 | * that triggered a cqm event. 0 indicates that no event has been |
380 | * generated for the current association. | 381 | * generated for the current association. |
@@ -478,6 +479,19 @@ enum ieee80211_sub_if_data_flags { | |||
478 | IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), | 479 | IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), |
479 | }; | 480 | }; |
480 | 481 | ||
482 | /** | ||
483 | * enum ieee80211_sdata_state_bits - virtual interface state bits | ||
484 | * @SDATA_STATE_RUNNING: virtual interface is up & running; this | ||
485 | * mirrors netif_running() but is separate for interface type | ||
486 | * change handling while the interface is up | ||
487 | * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel | ||
488 | * mode, so queues are stopped | ||
489 | */ | ||
490 | enum ieee80211_sdata_state_bits { | ||
491 | SDATA_STATE_RUNNING, | ||
492 | SDATA_STATE_OFFCHANNEL, | ||
493 | }; | ||
494 | |||
481 | struct ieee80211_sub_if_data { | 495 | struct ieee80211_sub_if_data { |
482 | struct list_head list; | 496 | struct list_head list; |
483 | 497 | ||
@@ -491,6 +505,8 @@ struct ieee80211_sub_if_data { | |||
491 | 505 | ||
492 | unsigned int flags; | 506 | unsigned int flags; |
493 | 507 | ||
508 | unsigned long state; | ||
509 | |||
494 | int drop_unencrypted; | 510 | int drop_unencrypted; |
495 | 511 | ||
496 | char name[IFNAMSIZ]; | 512 | char name[IFNAMSIZ]; |
@@ -515,6 +531,8 @@ struct ieee80211_sub_if_data { | |||
515 | struct ieee80211_key *default_mgmt_key; | 531 | struct ieee80211_key *default_mgmt_key; |
516 | 532 | ||
517 | u16 sequence_number; | 533 | u16 sequence_number; |
534 | __be16 control_port_protocol; | ||
535 | bool control_port_no_encrypt; | ||
518 | 536 | ||
519 | struct work_struct work; | 537 | struct work_struct work; |
520 | struct sk_buff_head skb_queue; | 538 | struct sk_buff_head skb_queue; |
@@ -602,11 +620,17 @@ enum queue_stop_reason { | |||
602 | * determine if we are on the operating channel or not | 620 | * determine if we are on the operating channel or not |
603 | * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, | 621 | * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, |
604 | * gets only set in conjunction with SCAN_SW_SCANNING | 622 | * gets only set in conjunction with SCAN_SW_SCANNING |
623 | * @SCAN_COMPLETED: Set for our scan work function when the driver reported | ||
624 | * that the scan completed. | ||
625 | * @SCAN_ABORTED: Set for our scan work function when the driver reported | ||
626 | * a scan complete for an aborted scan. | ||
605 | */ | 627 | */ |
606 | enum { | 628 | enum { |
607 | SCAN_SW_SCANNING, | 629 | SCAN_SW_SCANNING, |
608 | SCAN_HW_SCANNING, | 630 | SCAN_HW_SCANNING, |
609 | SCAN_OFF_CHANNEL, | 631 | SCAN_OFF_CHANNEL, |
632 | SCAN_COMPLETED, | ||
633 | SCAN_ABORTED, | ||
610 | }; | 634 | }; |
611 | 635 | ||
612 | /** | 636 | /** |
@@ -662,6 +686,8 @@ struct ieee80211_local { | |||
662 | int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll; | 686 | int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll; |
663 | unsigned int filter_flags; /* FIF_* */ | 687 | unsigned int filter_flags; /* FIF_* */ |
664 | 688 | ||
689 | bool wiphy_ciphers_allocated; | ||
690 | |||
665 | /* protects the aggregated multicast list and filter calls */ | 691 | /* protects the aggregated multicast list and filter calls */ |
666 | spinlock_t filter_lock; | 692 | spinlock_t filter_lock; |
667 | 693 | ||
@@ -1083,7 +1109,7 @@ void ieee80211_recalc_idle(struct ieee80211_local *local); | |||
1083 | 1109 | ||
1084 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) | 1110 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) |
1085 | { | 1111 | { |
1086 | return netif_running(sdata->dev); | 1112 | return test_bit(SDATA_STATE_RUNNING, &sdata->state); |
1087 | } | 1113 | } |
1088 | 1114 | ||
1089 | /* tx handling */ | 1115 | /* tx handling */ |
@@ -1160,6 +1186,12 @@ int __ieee80211_suspend(struct ieee80211_hw *hw); | |||
1160 | 1186 | ||
1161 | static inline int __ieee80211_resume(struct ieee80211_hw *hw) | 1187 | static inline int __ieee80211_resume(struct ieee80211_hw *hw) |
1162 | { | 1188 | { |
1189 | struct ieee80211_local *local = hw_to_local(hw); | ||
1190 | |||
1191 | WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), | ||
1192 | "%s: resume with hardware scan still in progress\n", | ||
1193 | wiphy_name(hw->wiphy)); | ||
1194 | |||
1163 | return ieee80211_reconfig(hw_to_local(hw)); | 1195 | return ieee80211_reconfig(hw_to_local(hw)); |
1164 | } | 1196 | } |
1165 | #else | 1197 | #else |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 86f434f234ae..c1cc200ac81f 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -94,21 +94,14 @@ static inline int identical_mac_addr_allowed(int type1, int type2) | |||
94 | type2 == NL80211_IFTYPE_AP_VLAN)); | 94 | type2 == NL80211_IFTYPE_AP_VLAN)); |
95 | } | 95 | } |
96 | 96 | ||
97 | static int ieee80211_open(struct net_device *dev) | 97 | static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, |
98 | enum nl80211_iftype iftype) | ||
98 | { | 99 | { |
99 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
100 | struct ieee80211_sub_if_data *nsdata; | ||
101 | struct ieee80211_local *local = sdata->local; | 100 | struct ieee80211_local *local = sdata->local; |
102 | struct sta_info *sta; | 101 | struct ieee80211_sub_if_data *nsdata; |
103 | u32 changed = 0; | 102 | struct net_device *dev = sdata->dev; |
104 | int res; | ||
105 | u32 hw_reconf_flags = 0; | ||
106 | u8 null_addr[ETH_ALEN] = {0}; | ||
107 | 103 | ||
108 | /* fail early if user set an invalid address */ | 104 | ASSERT_RTNL(); |
109 | if (compare_ether_addr(dev->dev_addr, null_addr) && | ||
110 | !is_valid_ether_addr(dev->dev_addr)) | ||
111 | return -EADDRNOTAVAIL; | ||
112 | 105 | ||
113 | /* we hold the RTNL here so can safely walk the list */ | 106 | /* we hold the RTNL here so can safely walk the list */ |
114 | list_for_each_entry(nsdata, &local->interfaces, list) { | 107 | list_for_each_entry(nsdata, &local->interfaces, list) { |
@@ -125,7 +118,7 @@ static int ieee80211_open(struct net_device *dev) | |||
125 | * belonging to the same hardware. Then, however, we're | 118 | * belonging to the same hardware. Then, however, we're |
126 | * faced with having to adopt two different TSF timers... | 119 | * faced with having to adopt two different TSF timers... |
127 | */ | 120 | */ |
128 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | 121 | if (iftype == NL80211_IFTYPE_ADHOC && |
129 | nsdata->vif.type == NL80211_IFTYPE_ADHOC) | 122 | nsdata->vif.type == NL80211_IFTYPE_ADHOC) |
130 | return -EBUSY; | 123 | return -EBUSY; |
131 | 124 | ||
@@ -139,19 +132,36 @@ static int ieee80211_open(struct net_device *dev) | |||
139 | /* | 132 | /* |
140 | * check whether it may have the same address | 133 | * check whether it may have the same address |
141 | */ | 134 | */ |
142 | if (!identical_mac_addr_allowed(sdata->vif.type, | 135 | if (!identical_mac_addr_allowed(iftype, |
143 | nsdata->vif.type)) | 136 | nsdata->vif.type)) |
144 | return -ENOTUNIQ; | 137 | return -ENOTUNIQ; |
145 | 138 | ||
146 | /* | 139 | /* |
147 | * can only add VLANs to enabled APs | 140 | * can only add VLANs to enabled APs |
148 | */ | 141 | */ |
149 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | 142 | if (iftype == NL80211_IFTYPE_AP_VLAN && |
150 | nsdata->vif.type == NL80211_IFTYPE_AP) | 143 | nsdata->vif.type == NL80211_IFTYPE_AP) |
151 | sdata->bss = &nsdata->u.ap; | 144 | sdata->bss = &nsdata->u.ap; |
152 | } | 145 | } |
153 | } | 146 | } |
154 | 147 | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | /* | ||
152 | * NOTE: Be very careful when changing this function, it must NOT return | ||
153 | * an error on interface type changes that have been pre-checked, so most | ||
154 | * checks should be in ieee80211_check_concurrent_iface. | ||
155 | */ | ||
156 | static int ieee80211_do_open(struct net_device *dev, bool coming_up) | ||
157 | { | ||
158 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
159 | struct ieee80211_local *local = sdata->local; | ||
160 | struct sta_info *sta; | ||
161 | u32 changed = 0; | ||
162 | int res; | ||
163 | u32 hw_reconf_flags = 0; | ||
164 | |||
155 | switch (sdata->vif.type) { | 165 | switch (sdata->vif.type) { |
156 | case NL80211_IFTYPE_WDS: | 166 | case NL80211_IFTYPE_WDS: |
157 | if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) | 167 | if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) |
@@ -195,33 +205,22 @@ static int ieee80211_open(struct net_device *dev) | |||
195 | } | 205 | } |
196 | 206 | ||
197 | /* | 207 | /* |
198 | * Check all interfaces and copy the hopefully now-present | 208 | * Copy the hopefully now-present MAC address to |
199 | * MAC address to those that have the special null one. | 209 | * this interface, if it has the special null one. |
200 | */ | 210 | */ |
201 | list_for_each_entry(nsdata, &local->interfaces, list) { | 211 | if (is_zero_ether_addr(dev->dev_addr)) { |
202 | struct net_device *ndev = nsdata->dev; | 212 | memcpy(dev->dev_addr, |
203 | 213 | local->hw.wiphy->perm_addr, | |
204 | /* | 214 | ETH_ALEN); |
205 | * No need to check running since we do not allow | 215 | memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); |
206 | * it to start up with this invalid address. | 216 | |
207 | */ | 217 | if (!is_valid_ether_addr(dev->dev_addr)) { |
208 | if (compare_ether_addr(null_addr, ndev->dev_addr) == 0) { | 218 | if (!local->open_count) |
209 | memcpy(ndev->dev_addr, | 219 | drv_stop(local); |
210 | local->hw.wiphy->perm_addr, | 220 | return -EADDRNOTAVAIL; |
211 | ETH_ALEN); | ||
212 | memcpy(ndev->perm_addr, ndev->dev_addr, ETH_ALEN); | ||
213 | } | 221 | } |
214 | } | 222 | } |
215 | 223 | ||
216 | /* | ||
217 | * Validate the MAC address for this device. | ||
218 | */ | ||
219 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
220 | if (!local->open_count) | ||
221 | drv_stop(local); | ||
222 | return -EADDRNOTAVAIL; | ||
223 | } | ||
224 | |||
225 | switch (sdata->vif.type) { | 224 | switch (sdata->vif.type) { |
226 | case NL80211_IFTYPE_AP_VLAN: | 225 | case NL80211_IFTYPE_AP_VLAN: |
227 | /* no need to tell driver */ | 226 | /* no need to tell driver */ |
@@ -255,9 +254,11 @@ static int ieee80211_open(struct net_device *dev) | |||
255 | netif_carrier_on(dev); | 254 | netif_carrier_on(dev); |
256 | break; | 255 | break; |
257 | default: | 256 | default: |
258 | res = drv_add_interface(local, &sdata->vif); | 257 | if (coming_up) { |
259 | if (res) | 258 | res = drv_add_interface(local, &sdata->vif); |
260 | goto err_stop; | 259 | if (res) |
260 | goto err_stop; | ||
261 | } | ||
261 | 262 | ||
262 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | 263 | if (ieee80211_vif_is_mesh(&sdata->vif)) { |
263 | local->fif_other_bss++; | 264 | local->fif_other_bss++; |
@@ -313,7 +314,9 @@ static int ieee80211_open(struct net_device *dev) | |||
313 | hw_reconf_flags |= __ieee80211_recalc_idle(local); | 314 | hw_reconf_flags |= __ieee80211_recalc_idle(local); |
314 | mutex_unlock(&local->mtx); | 315 | mutex_unlock(&local->mtx); |
315 | 316 | ||
316 | local->open_count++; | 317 | if (coming_up) |
318 | local->open_count++; | ||
319 | |||
317 | if (hw_reconf_flags) { | 320 | if (hw_reconf_flags) { |
318 | ieee80211_hw_config(local, hw_reconf_flags); | 321 | ieee80211_hw_config(local, hw_reconf_flags); |
319 | /* | 322 | /* |
@@ -328,6 +331,8 @@ static int ieee80211_open(struct net_device *dev) | |||
328 | 331 | ||
329 | netif_tx_start_all_queues(dev); | 332 | netif_tx_start_all_queues(dev); |
330 | 333 | ||
334 | set_bit(SDATA_STATE_RUNNING, &sdata->state); | ||
335 | |||
331 | return 0; | 336 | return 0; |
332 | err_del_interface: | 337 | err_del_interface: |
333 | drv_remove_interface(local, &sdata->vif); | 338 | drv_remove_interface(local, &sdata->vif); |
@@ -341,19 +346,38 @@ static int ieee80211_open(struct net_device *dev) | |||
341 | return res; | 346 | return res; |
342 | } | 347 | } |
343 | 348 | ||
344 | static int ieee80211_stop(struct net_device *dev) | 349 | static int ieee80211_open(struct net_device *dev) |
345 | { | 350 | { |
346 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 351 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
352 | int err; | ||
353 | |||
354 | /* fail early if user set an invalid address */ | ||
355 | if (!is_zero_ether_addr(dev->dev_addr) && | ||
356 | !is_valid_ether_addr(dev->dev_addr)) | ||
357 | return -EADDRNOTAVAIL; | ||
358 | |||
359 | err = ieee80211_check_concurrent_iface(sdata, sdata->vif.type); | ||
360 | if (err) | ||
361 | return err; | ||
362 | |||
363 | return ieee80211_do_open(dev, true); | ||
364 | } | ||
365 | |||
366 | static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | ||
367 | bool going_down) | ||
368 | { | ||
347 | struct ieee80211_local *local = sdata->local; | 369 | struct ieee80211_local *local = sdata->local; |
348 | unsigned long flags; | 370 | unsigned long flags; |
349 | struct sk_buff *skb, *tmp; | 371 | struct sk_buff *skb, *tmp; |
350 | u32 hw_reconf_flags = 0; | 372 | u32 hw_reconf_flags = 0; |
351 | int i; | 373 | int i; |
352 | 374 | ||
375 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); | ||
376 | |||
353 | /* | 377 | /* |
354 | * Stop TX on this interface first. | 378 | * Stop TX on this interface first. |
355 | */ | 379 | */ |
356 | netif_tx_stop_all_queues(dev); | 380 | netif_tx_stop_all_queues(sdata->dev); |
357 | 381 | ||
358 | /* | 382 | /* |
359 | * Purge work for this interface. | 383 | * Purge work for this interface. |
@@ -370,12 +394,9 @@ static int ieee80211_stop(struct net_device *dev) | |||
370 | * (because if we remove a STA after ops->remove_interface() | 394 | * (because if we remove a STA after ops->remove_interface() |
371 | * the driver will have removed the vif info already!) | 395 | * the driver will have removed the vif info already!) |
372 | * | 396 | * |
373 | * We could relax this and only unlink the stations from the | 397 | * This is relevant only in AP, WDS and mesh modes, since in |
374 | * hash table and list but keep them on a per-sdata list that | 398 | * all other modes we've already removed all stations when |
375 | * will be inserted back again when the interface is brought | 399 | * disconnecting etc. |
376 | * up again, but I don't currently see a use case for that, | ||
377 | * except with WDS which gets a STA entry created when it is | ||
378 | * brought up. | ||
379 | */ | 400 | */ |
380 | sta_info_flush(local, sdata); | 401 | sta_info_flush(local, sdata); |
381 | 402 | ||
@@ -394,11 +415,12 @@ static int ieee80211_stop(struct net_device *dev) | |||
394 | if (sdata->vif.type == NL80211_IFTYPE_AP) | 415 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
395 | local->fif_pspoll--; | 416 | local->fif_pspoll--; |
396 | 417 | ||
397 | netif_addr_lock_bh(dev); | 418 | netif_addr_lock_bh(sdata->dev); |
398 | spin_lock_bh(&local->filter_lock); | 419 | spin_lock_bh(&local->filter_lock); |
399 | __hw_addr_unsync(&local->mc_list, &dev->mc, dev->addr_len); | 420 | __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, |
421 | sdata->dev->addr_len); | ||
400 | spin_unlock_bh(&local->filter_lock); | 422 | spin_unlock_bh(&local->filter_lock); |
401 | netif_addr_unlock_bh(dev); | 423 | netif_addr_unlock_bh(sdata->dev); |
402 | 424 | ||
403 | ieee80211_configure_filter(local); | 425 | ieee80211_configure_filter(local); |
404 | 426 | ||
@@ -410,11 +432,21 @@ static int ieee80211_stop(struct net_device *dev) | |||
410 | struct ieee80211_sub_if_data *vlan, *tmpsdata; | 432 | struct ieee80211_sub_if_data *vlan, *tmpsdata; |
411 | struct beacon_data *old_beacon = sdata->u.ap.beacon; | 433 | struct beacon_data *old_beacon = sdata->u.ap.beacon; |
412 | 434 | ||
435 | /* sdata_running will return false, so this will disable */ | ||
436 | ieee80211_bss_info_change_notify(sdata, | ||
437 | BSS_CHANGED_BEACON_ENABLED); | ||
438 | |||
413 | /* remove beacon */ | 439 | /* remove beacon */ |
414 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); | 440 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); |
415 | synchronize_rcu(); | 441 | synchronize_rcu(); |
416 | kfree(old_beacon); | 442 | kfree(old_beacon); |
417 | 443 | ||
444 | /* free all potentially still buffered bcast frames */ | ||
445 | while ((skb = skb_dequeue(&sdata->u.ap.ps_bc_buf))) { | ||
446 | local->total_ps_buffered--; | ||
447 | dev_kfree_skb(skb); | ||
448 | } | ||
449 | |||
418 | /* down all dependent devices, that is VLANs */ | 450 | /* down all dependent devices, that is VLANs */ |
419 | list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, | 451 | list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, |
420 | u.vlan.list) | 452 | u.vlan.list) |
@@ -422,7 +454,8 @@ static int ieee80211_stop(struct net_device *dev) | |||
422 | WARN_ON(!list_empty(&sdata->u.ap.vlans)); | 454 | WARN_ON(!list_empty(&sdata->u.ap.vlans)); |
423 | } | 455 | } |
424 | 456 | ||
425 | local->open_count--; | 457 | if (going_down) |
458 | local->open_count--; | ||
426 | 459 | ||
427 | switch (sdata->vif.type) { | 460 | switch (sdata->vif.type) { |
428 | case NL80211_IFTYPE_AP_VLAN: | 461 | case NL80211_IFTYPE_AP_VLAN: |
@@ -454,27 +487,6 @@ static int ieee80211_stop(struct net_device *dev) | |||
454 | 487 | ||
455 | ieee80211_configure_filter(local); | 488 | ieee80211_configure_filter(local); |
456 | break; | 489 | break; |
457 | case NL80211_IFTYPE_STATION: | ||
458 | del_timer_sync(&sdata->u.mgd.chswitch_timer); | ||
459 | del_timer_sync(&sdata->u.mgd.timer); | ||
460 | del_timer_sync(&sdata->u.mgd.conn_mon_timer); | ||
461 | del_timer_sync(&sdata->u.mgd.bcn_mon_timer); | ||
462 | /* | ||
463 | * If any of the timers fired while we waited for it, it will | ||
464 | * have queued its work. Now the work will be running again | ||
465 | * but will not rearm the timer again because it checks | ||
466 | * whether the interface is running, which, at this point, | ||
467 | * it no longer is. | ||
468 | */ | ||
469 | cancel_work_sync(&sdata->u.mgd.chswitch_work); | ||
470 | cancel_work_sync(&sdata->u.mgd.monitor_work); | ||
471 | cancel_work_sync(&sdata->u.mgd.beacon_connection_loss_work); | ||
472 | |||
473 | /* fall through */ | ||
474 | case NL80211_IFTYPE_ADHOC: | ||
475 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) | ||
476 | del_timer_sync(&sdata->u.ibss.timer); | ||
477 | /* fall through */ | ||
478 | case NL80211_IFTYPE_MESH_POINT: | 490 | case NL80211_IFTYPE_MESH_POINT: |
479 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | 491 | if (ieee80211_vif_is_mesh(&sdata->vif)) { |
480 | /* other_bss and allmulti are always set on mesh | 492 | /* other_bss and allmulti are always set on mesh |
@@ -502,18 +514,21 @@ static int ieee80211_stop(struct net_device *dev) | |||
502 | ieee80211_scan_cancel(local); | 514 | ieee80211_scan_cancel(local); |
503 | 515 | ||
504 | /* | 516 | /* |
505 | * Disable beaconing for AP and mesh, IBSS can't | 517 | * Disable beaconing here for mesh only, AP and IBSS |
506 | * still be joined to a network at this point. | 518 | * are already taken care of. |
507 | */ | 519 | */ |
508 | if (sdata->vif.type == NL80211_IFTYPE_AP || | 520 | if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) |
509 | sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { | ||
510 | ieee80211_bss_info_change_notify(sdata, | 521 | ieee80211_bss_info_change_notify(sdata, |
511 | BSS_CHANGED_BEACON_ENABLED); | 522 | BSS_CHANGED_BEACON_ENABLED); |
512 | } | ||
513 | 523 | ||
514 | /* free all remaining keys, there shouldn't be any */ | 524 | /* |
525 | * Free all remaining keys, there shouldn't be any, | ||
526 | * except maybe group keys in AP more or WDS? | ||
527 | */ | ||
515 | ieee80211_free_keys(sdata); | 528 | ieee80211_free_keys(sdata); |
516 | drv_remove_interface(local, &sdata->vif); | 529 | |
530 | if (going_down) | ||
531 | drv_remove_interface(local, &sdata->vif); | ||
517 | } | 532 | } |
518 | 533 | ||
519 | sdata->bss = NULL; | 534 | sdata->bss = NULL; |
@@ -549,6 +564,13 @@ static int ieee80211_stop(struct net_device *dev) | |||
549 | } | 564 | } |
550 | } | 565 | } |
551 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | 566 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
567 | } | ||
568 | |||
569 | static int ieee80211_stop(struct net_device *dev) | ||
570 | { | ||
571 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
572 | |||
573 | ieee80211_do_stop(sdata, true); | ||
552 | 574 | ||
553 | return 0; | 575 | return 0; |
554 | } | 576 | } |
@@ -593,8 +615,6 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
593 | { | 615 | { |
594 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 616 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
595 | struct ieee80211_local *local = sdata->local; | 617 | struct ieee80211_local *local = sdata->local; |
596 | struct beacon_data *beacon; | ||
597 | struct sk_buff *skb; | ||
598 | int flushed; | 618 | int flushed; |
599 | int i; | 619 | int i; |
600 | 620 | ||
@@ -607,37 +627,8 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
607 | __skb_queue_purge(&sdata->fragments[i].skb_list); | 627 | __skb_queue_purge(&sdata->fragments[i].skb_list); |
608 | sdata->fragment_next = 0; | 628 | sdata->fragment_next = 0; |
609 | 629 | ||
610 | switch (sdata->vif.type) { | 630 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
611 | case NL80211_IFTYPE_AP: | 631 | mesh_rmc_free(sdata); |
612 | beacon = sdata->u.ap.beacon; | ||
613 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); | ||
614 | synchronize_rcu(); | ||
615 | kfree(beacon); | ||
616 | |||
617 | while ((skb = skb_dequeue(&sdata->u.ap.ps_bc_buf))) { | ||
618 | local->total_ps_buffered--; | ||
619 | dev_kfree_skb(skb); | ||
620 | } | ||
621 | |||
622 | break; | ||
623 | case NL80211_IFTYPE_MESH_POINT: | ||
624 | if (ieee80211_vif_is_mesh(&sdata->vif)) | ||
625 | mesh_rmc_free(sdata); | ||
626 | break; | ||
627 | case NL80211_IFTYPE_ADHOC: | ||
628 | if (WARN_ON(sdata->u.ibss.presp)) | ||
629 | kfree_skb(sdata->u.ibss.presp); | ||
630 | break; | ||
631 | case NL80211_IFTYPE_STATION: | ||
632 | case NL80211_IFTYPE_WDS: | ||
633 | case NL80211_IFTYPE_AP_VLAN: | ||
634 | case NL80211_IFTYPE_MONITOR: | ||
635 | break; | ||
636 | case NL80211_IFTYPE_UNSPECIFIED: | ||
637 | case NUM_NL80211_IFTYPES: | ||
638 | BUG(); | ||
639 | break; | ||
640 | } | ||
641 | 632 | ||
642 | flushed = sta_info_flush(local, sdata); | 633 | flushed = sta_info_flush(local, sdata); |
643 | WARN_ON(flushed); | 634 | WARN_ON(flushed); |
@@ -855,6 +846,9 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
855 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; | 846 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; |
856 | sdata->wdev.iftype = type; | 847 | sdata->wdev.iftype = type; |
857 | 848 | ||
849 | sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); | ||
850 | sdata->control_port_no_encrypt = false; | ||
851 | |||
858 | /* only monitor differs */ | 852 | /* only monitor differs */ |
859 | sdata->dev->type = ARPHRD_ETHER; | 853 | sdata->dev->type = ARPHRD_ETHER; |
860 | 854 | ||
@@ -894,9 +888,72 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
894 | ieee80211_debugfs_add_netdev(sdata); | 888 | ieee80211_debugfs_add_netdev(sdata); |
895 | } | 889 | } |
896 | 890 | ||
891 | static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | ||
892 | enum nl80211_iftype type) | ||
893 | { | ||
894 | struct ieee80211_local *local = sdata->local; | ||
895 | int ret, err; | ||
896 | |||
897 | ASSERT_RTNL(); | ||
898 | |||
899 | if (!local->ops->change_interface) | ||
900 | return -EBUSY; | ||
901 | |||
902 | switch (sdata->vif.type) { | ||
903 | case NL80211_IFTYPE_AP: | ||
904 | case NL80211_IFTYPE_STATION: | ||
905 | case NL80211_IFTYPE_ADHOC: | ||
906 | /* | ||
907 | * Could maybe also all others here? | ||
908 | * Just not sure how that interacts | ||
909 | * with the RX/config path e.g. for | ||
910 | * mesh. | ||
911 | */ | ||
912 | break; | ||
913 | default: | ||
914 | return -EBUSY; | ||
915 | } | ||
916 | |||
917 | switch (type) { | ||
918 | case NL80211_IFTYPE_AP: | ||
919 | case NL80211_IFTYPE_STATION: | ||
920 | case NL80211_IFTYPE_ADHOC: | ||
921 | /* | ||
922 | * Could probably support everything | ||
923 | * but WDS here (WDS do_open can fail | ||
924 | * under memory pressure, which this | ||
925 | * code isn't prepared to handle). | ||
926 | */ | ||
927 | break; | ||
928 | default: | ||
929 | return -EBUSY; | ||
930 | } | ||
931 | |||
932 | ret = ieee80211_check_concurrent_iface(sdata, type); | ||
933 | if (ret) | ||
934 | return ret; | ||
935 | |||
936 | ieee80211_do_stop(sdata, false); | ||
937 | |||
938 | ieee80211_teardown_sdata(sdata->dev); | ||
939 | |||
940 | ret = drv_change_interface(local, sdata, type); | ||
941 | if (ret) | ||
942 | type = sdata->vif.type; | ||
943 | |||
944 | ieee80211_setup_sdata(sdata, type); | ||
945 | |||
946 | err = ieee80211_do_open(sdata->dev, false); | ||
947 | WARN(err, "type change: do_open returned %d", err); | ||
948 | |||
949 | return ret; | ||
950 | } | ||
951 | |||
897 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | 952 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, |
898 | enum nl80211_iftype type) | 953 | enum nl80211_iftype type) |
899 | { | 954 | { |
955 | int ret; | ||
956 | |||
900 | ASSERT_RTNL(); | 957 | ASSERT_RTNL(); |
901 | 958 | ||
902 | if (type == sdata->vif.type) | 959 | if (type == sdata->vif.type) |
@@ -907,18 +964,15 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
907 | type == NL80211_IFTYPE_ADHOC) | 964 | type == NL80211_IFTYPE_ADHOC) |
908 | return -EOPNOTSUPP; | 965 | return -EOPNOTSUPP; |
909 | 966 | ||
910 | /* | 967 | if (ieee80211_sdata_running(sdata)) { |
911 | * We could, here, on changes between IBSS/STA/MESH modes, | 968 | ret = ieee80211_runtime_change_iftype(sdata, type); |
912 | * invoke an MLME function instead that disassociates etc. | 969 | if (ret) |
913 | * and goes into the requested mode. | 970 | return ret; |
914 | */ | 971 | } else { |
915 | 972 | /* Purge and reset type-dependent state. */ | |
916 | if (ieee80211_sdata_running(sdata)) | 973 | ieee80211_teardown_sdata(sdata->dev); |
917 | return -EBUSY; | 974 | ieee80211_setup_sdata(sdata, type); |
918 | 975 | } | |
919 | /* Purge and reset type-dependent state. */ | ||
920 | ieee80211_teardown_sdata(sdata->dev); | ||
921 | ieee80211_setup_sdata(sdata, type); | ||
922 | 976 | ||
923 | /* reset some values that shouldn't be kept across type changes */ | 977 | /* reset some values that shouldn't be kept across type changes */ |
924 | sdata->vif.bss_conf.basic_rates = | 978 | sdata->vif.bss_conf.basic_rates = |
@@ -1175,8 +1229,7 @@ static u32 ieee80211_idle_off(struct ieee80211_local *local, | |||
1175 | return 0; | 1229 | return 0; |
1176 | 1230 | ||
1177 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1231 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1178 | printk(KERN_DEBUG "%s: device no longer idle - %s\n", | 1232 | wiphy_debug(local->hw.wiphy, "device no longer idle - %s\n", reason); |
1179 | wiphy_name(local->hw.wiphy), reason); | ||
1180 | #endif | 1233 | #endif |
1181 | 1234 | ||
1182 | local->hw.conf.flags &= ~IEEE80211_CONF_IDLE; | 1235 | local->hw.conf.flags &= ~IEEE80211_CONF_IDLE; |
@@ -1189,8 +1242,7 @@ static u32 ieee80211_idle_on(struct ieee80211_local *local) | |||
1189 | return 0; | 1242 | return 0; |
1190 | 1243 | ||
1191 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1244 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1192 | printk(KERN_DEBUG "%s: device now idle\n", | 1245 | wiphy_debug(local->hw.wiphy, "device now idle\n"); |
1193 | wiphy_name(local->hw.wiphy)); | ||
1194 | #endif | 1246 | #endif |
1195 | 1247 | ||
1196 | drv_flush(local, false); | 1248 | drv_flush(local, false); |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 9c27c53cfae5..3570f8c2bb40 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -60,7 +60,7 @@ static struct ieee80211_sta *get_sta_for_key(struct ieee80211_key *key) | |||
60 | return NULL; | 60 | return NULL; |
61 | } | 61 | } |
62 | 62 | ||
63 | static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | 63 | static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) |
64 | { | 64 | { |
65 | struct ieee80211_sub_if_data *sdata; | 65 | struct ieee80211_sub_if_data *sdata; |
66 | struct ieee80211_sta *sta; | 66 | struct ieee80211_sta *sta; |
@@ -68,8 +68,10 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
68 | 68 | ||
69 | might_sleep(); | 69 | might_sleep(); |
70 | 70 | ||
71 | if (!key->local->ops->set_key) | 71 | if (!key->local->ops->set_key) { |
72 | return; | 72 | ret = -EOPNOTSUPP; |
73 | goto out_unsupported; | ||
74 | } | ||
73 | 75 | ||
74 | assert_key_lock(key->local); | 76 | assert_key_lock(key->local); |
75 | 77 | ||
@@ -87,10 +89,27 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
87 | key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; | 89 | key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; |
88 | 90 | ||
89 | if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) | 91 | if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) |
90 | printk(KERN_ERR "mac80211-%s: failed to set key " | 92 | wiphy_err(key->local->hw.wiphy, |
91 | "(%d, %pM) to hardware (%d)\n", | 93 | "failed to set key (%d, %pM) to hardware (%d)\n", |
92 | wiphy_name(key->local->hw.wiphy), | 94 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); |
93 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); | 95 | |
96 | out_unsupported: | ||
97 | if (ret) { | ||
98 | switch (key->conf.cipher) { | ||
99 | case WLAN_CIPHER_SUITE_WEP40: | ||
100 | case WLAN_CIPHER_SUITE_WEP104: | ||
101 | case WLAN_CIPHER_SUITE_TKIP: | ||
102 | case WLAN_CIPHER_SUITE_CCMP: | ||
103 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
104 | /* all of these we can do in software */ | ||
105 | ret = 0; | ||
106 | break; | ||
107 | default: | ||
108 | ret = -EINVAL; | ||
109 | } | ||
110 | } | ||
111 | |||
112 | return ret; | ||
94 | } | 113 | } |
95 | 114 | ||
96 | static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | 115 | static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) |
@@ -121,10 +140,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
121 | sta, &key->conf); | 140 | sta, &key->conf); |
122 | 141 | ||
123 | if (ret) | 142 | if (ret) |
124 | printk(KERN_ERR "mac80211-%s: failed to remove key " | 143 | wiphy_err(key->local->hw.wiphy, |
125 | "(%d, %pM) from hardware (%d)\n", | 144 | "failed to remove key (%d, %pM) from hardware (%d)\n", |
126 | wiphy_name(key->local->hw.wiphy), | 145 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); |
127 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); | ||
128 | 146 | ||
129 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; | 147 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; |
130 | } | 148 | } |
@@ -331,12 +349,12 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key) | |||
331 | kfree(key); | 349 | kfree(key); |
332 | } | 350 | } |
333 | 351 | ||
334 | void ieee80211_key_link(struct ieee80211_key *key, | 352 | int ieee80211_key_link(struct ieee80211_key *key, |
335 | struct ieee80211_sub_if_data *sdata, | 353 | struct ieee80211_sub_if_data *sdata, |
336 | struct sta_info *sta) | 354 | struct sta_info *sta) |
337 | { | 355 | { |
338 | struct ieee80211_key *old_key; | 356 | struct ieee80211_key *old_key; |
339 | int idx; | 357 | int idx, ret; |
340 | 358 | ||
341 | BUG_ON(!sdata); | 359 | BUG_ON(!sdata); |
342 | BUG_ON(!key); | 360 | BUG_ON(!key); |
@@ -391,9 +409,11 @@ void ieee80211_key_link(struct ieee80211_key *key, | |||
391 | 409 | ||
392 | ieee80211_debugfs_key_add(key); | 410 | ieee80211_debugfs_key_add(key); |
393 | 411 | ||
394 | ieee80211_key_enable_hw_accel(key); | 412 | ret = ieee80211_key_enable_hw_accel(key); |
395 | 413 | ||
396 | mutex_unlock(&sdata->local->key_mtx); | 414 | mutex_unlock(&sdata->local->key_mtx); |
415 | |||
416 | return ret; | ||
397 | } | 417 | } |
398 | 418 | ||
399 | static void __ieee80211_key_free(struct ieee80211_key *key) | 419 | static void __ieee80211_key_free(struct ieee80211_key *key) |
diff --git a/net/mac80211/key.h b/net/mac80211/key.h index 53b5ce12536f..cb9a4a65cc68 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h | |||
@@ -130,9 +130,9 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
130 | * Insert a key into data structures (sdata, sta if necessary) | 130 | * Insert a key into data structures (sdata, sta if necessary) |
131 | * to make it used, free old key. | 131 | * to make it used, free old key. |
132 | */ | 132 | */ |
133 | void ieee80211_key_link(struct ieee80211_key *key, | 133 | int __must_check ieee80211_key_link(struct ieee80211_key *key, |
134 | struct ieee80211_sub_if_data *sdata, | 134 | struct ieee80211_sub_if_data *sdata, |
135 | struct sta_info *sta); | 135 | struct sta_info *sta); |
136 | void ieee80211_key_free(struct ieee80211_local *local, | 136 | void ieee80211_key_free(struct ieee80211_local *local, |
137 | struct ieee80211_key *key); | 137 | struct ieee80211_key *key); |
138 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx); | 138 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index a53feac4618c..a06b6ee63c07 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -305,7 +305,13 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw) | |||
305 | 305 | ||
306 | trace_api_restart_hw(local); | 306 | trace_api_restart_hw(local); |
307 | 307 | ||
308 | /* use this reason, __ieee80211_resume will unblock it */ | 308 | WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), |
309 | "%s called with hardware scan in progress\n", __func__); | ||
310 | |||
311 | if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning))) | ||
312 | ieee80211_scan_cancel(local); | ||
313 | |||
314 | /* use this reason, ieee80211_reconfig will unblock it */ | ||
309 | ieee80211_stop_queues_by_reason(hw, | 315 | ieee80211_stop_queues_by_reason(hw, |
310 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); | 316 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); |
311 | 317 | ||
@@ -339,9 +345,6 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, | |||
339 | struct ieee80211_if_managed *ifmgd; | 345 | struct ieee80211_if_managed *ifmgd; |
340 | int c = 0; | 346 | int c = 0; |
341 | 347 | ||
342 | if (!netif_running(ndev)) | ||
343 | return NOTIFY_DONE; | ||
344 | |||
345 | /* Make sure it's our interface that got changed */ | 348 | /* Make sure it's our interface that got changed */ |
346 | if (!wdev) | 349 | if (!wdev) |
347 | return NOTIFY_DONE; | 350 | return NOTIFY_DONE; |
@@ -352,6 +355,9 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, | |||
352 | sdata = IEEE80211_DEV_TO_SUB_IF(ndev); | 355 | sdata = IEEE80211_DEV_TO_SUB_IF(ndev); |
353 | bss_conf = &sdata->vif.bss_conf; | 356 | bss_conf = &sdata->vif.bss_conf; |
354 | 357 | ||
358 | if (!ieee80211_sdata_running(sdata)) | ||
359 | return NOTIFY_DONE; | ||
360 | |||
355 | /* ARP filtering is only supported in managed mode */ | 361 | /* ARP filtering is only supported in managed mode */ |
356 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 362 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
357 | return NOTIFY_DONE; | 363 | return NOTIFY_DONE; |
@@ -622,6 +628,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
622 | /* mac80211 always supports monitor */ | 628 | /* mac80211 always supports monitor */ |
623 | local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); | 629 | local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
624 | 630 | ||
631 | #ifndef CONFIG_MAC80211_MESH | ||
632 | /* mesh depends on Kconfig, but drivers should set it if they want */ | ||
633 | local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT); | ||
634 | #endif | ||
635 | |||
636 | /* mac80211 supports control port protocol changing */ | ||
637 | local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL; | ||
638 | |||
625 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) | 639 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) |
626 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; | 640 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
627 | else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) | 641 | else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) |
@@ -657,13 +671,40 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
657 | if (local->hw.wiphy->max_scan_ie_len) | 671 | if (local->hw.wiphy->max_scan_ie_len) |
658 | local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; | 672 | local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; |
659 | 673 | ||
660 | local->hw.wiphy->cipher_suites = cipher_suites; | 674 | /* Set up cipher suites unless driver already did */ |
661 | local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); | 675 | if (!local->hw.wiphy->cipher_suites) { |
662 | if (!(local->hw.flags & IEEE80211_HW_MFP_CAPABLE)) | 676 | local->hw.wiphy->cipher_suites = cipher_suites; |
663 | local->hw.wiphy->n_cipher_suites--; | 677 | local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); |
678 | if (!(local->hw.flags & IEEE80211_HW_MFP_CAPABLE)) | ||
679 | local->hw.wiphy->n_cipher_suites--; | ||
680 | } | ||
664 | if (IS_ERR(local->wep_tx_tfm) || IS_ERR(local->wep_rx_tfm)) { | 681 | if (IS_ERR(local->wep_tx_tfm) || IS_ERR(local->wep_rx_tfm)) { |
665 | local->hw.wiphy->cipher_suites += 2; | 682 | if (local->hw.wiphy->cipher_suites == cipher_suites) { |
666 | local->hw.wiphy->n_cipher_suites -= 2; | 683 | local->hw.wiphy->cipher_suites += 2; |
684 | local->hw.wiphy->n_cipher_suites -= 2; | ||
685 | } else { | ||
686 | u32 *suites; | ||
687 | int r, w = 0; | ||
688 | |||
689 | /* Filter out WEP */ | ||
690 | |||
691 | suites = kmemdup( | ||
692 | local->hw.wiphy->cipher_suites, | ||
693 | sizeof(u32) * local->hw.wiphy->n_cipher_suites, | ||
694 | GFP_KERNEL); | ||
695 | if (!suites) | ||
696 | return -ENOMEM; | ||
697 | for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) { | ||
698 | u32 suite = local->hw.wiphy->cipher_suites[r]; | ||
699 | if (suite == WLAN_CIPHER_SUITE_WEP40 || | ||
700 | suite == WLAN_CIPHER_SUITE_WEP104) | ||
701 | continue; | ||
702 | suites[w++] = suite; | ||
703 | } | ||
704 | local->hw.wiphy->cipher_suites = suites; | ||
705 | local->hw.wiphy->n_cipher_suites = w; | ||
706 | local->wiphy_ciphers_allocated = true; | ||
707 | } | ||
667 | } | 708 | } |
668 | 709 | ||
669 | result = wiphy_register(local->hw.wiphy); | 710 | result = wiphy_register(local->hw.wiphy); |
@@ -713,16 +754,16 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
713 | 754 | ||
714 | result = ieee80211_wep_init(local); | 755 | result = ieee80211_wep_init(local); |
715 | if (result < 0) | 756 | if (result < 0) |
716 | printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n", | 757 | wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", |
717 | wiphy_name(local->hw.wiphy), result); | 758 | result); |
718 | 759 | ||
719 | rtnl_lock(); | 760 | rtnl_lock(); |
720 | 761 | ||
721 | result = ieee80211_init_rate_ctrl_alg(local, | 762 | result = ieee80211_init_rate_ctrl_alg(local, |
722 | hw->rate_control_algorithm); | 763 | hw->rate_control_algorithm); |
723 | if (result < 0) { | 764 | if (result < 0) { |
724 | printk(KERN_DEBUG "%s: Failed to initialize rate control " | 765 | wiphy_debug(local->hw.wiphy, |
725 | "algorithm\n", wiphy_name(local->hw.wiphy)); | 766 | "Failed to initialize rate control algorithm\n"); |
726 | goto fail_rate; | 767 | goto fail_rate; |
727 | } | 768 | } |
728 | 769 | ||
@@ -731,8 +772,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
731 | result = ieee80211_if_add(local, "wlan%d", NULL, | 772 | result = ieee80211_if_add(local, "wlan%d", NULL, |
732 | NL80211_IFTYPE_STATION, NULL); | 773 | NL80211_IFTYPE_STATION, NULL); |
733 | if (result) | 774 | if (result) |
734 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", | 775 | wiphy_warn(local->hw.wiphy, |
735 | wiphy_name(local->hw.wiphy)); | 776 | "Failed to add default virtual iface\n"); |
736 | } | 777 | } |
737 | 778 | ||
738 | rtnl_unlock(); | 779 | rtnl_unlock(); |
@@ -778,6 +819,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
778 | fail_workqueue: | 819 | fail_workqueue: |
779 | wiphy_unregister(local->hw.wiphy); | 820 | wiphy_unregister(local->hw.wiphy); |
780 | fail_wiphy_register: | 821 | fail_wiphy_register: |
822 | if (local->wiphy_ciphers_allocated) | ||
823 | kfree(local->hw.wiphy->cipher_suites); | ||
781 | kfree(local->int_scan_req); | 824 | kfree(local->int_scan_req); |
782 | return result; | 825 | return result; |
783 | } | 826 | } |
@@ -807,6 +850,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) | |||
807 | 850 | ||
808 | rtnl_unlock(); | 851 | rtnl_unlock(); |
809 | 852 | ||
853 | cancel_work_sync(&local->restart_work); | ||
810 | cancel_work_sync(&local->reconfig_filter); | 854 | cancel_work_sync(&local->reconfig_filter); |
811 | 855 | ||
812 | ieee80211_clear_tx_pending(local); | 856 | ieee80211_clear_tx_pending(local); |
@@ -815,8 +859,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) | |||
815 | 859 | ||
816 | if (skb_queue_len(&local->skb_queue) || | 860 | if (skb_queue_len(&local->skb_queue) || |
817 | skb_queue_len(&local->skb_queue_unreliable)) | 861 | skb_queue_len(&local->skb_queue_unreliable)) |
818 | printk(KERN_WARNING "%s: skb_queue not empty\n", | 862 | wiphy_warn(local->hw.wiphy, "skb_queue not empty\n"); |
819 | wiphy_name(local->hw.wiphy)); | ||
820 | skb_queue_purge(&local->skb_queue); | 863 | skb_queue_purge(&local->skb_queue); |
821 | skb_queue_purge(&local->skb_queue_unreliable); | 864 | skb_queue_purge(&local->skb_queue_unreliable); |
822 | 865 | ||
@@ -835,6 +878,9 @@ void ieee80211_free_hw(struct ieee80211_hw *hw) | |||
835 | mutex_destroy(&local->iflist_mtx); | 878 | mutex_destroy(&local->iflist_mtx); |
836 | mutex_destroy(&local->mtx); | 879 | mutex_destroy(&local->mtx); |
837 | 880 | ||
881 | if (local->wiphy_ciphers_allocated) | ||
882 | kfree(local->hw.wiphy->cipher_suites); | ||
883 | |||
838 | wiphy_free(local->hw.wiphy); | 884 | wiphy_free(local->hw.wiphy); |
839 | } | 885 | } |
840 | EXPORT_SYMBOL(ieee80211_free_hw); | 886 | EXPORT_SYMBOL(ieee80211_free_hw); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 38996a44aa8e..0cb822cc12e9 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -54,6 +54,12 @@ | |||
54 | */ | 54 | */ |
55 | #define IEEE80211_SIGNAL_AVE_WEIGHT 3 | 55 | #define IEEE80211_SIGNAL_AVE_WEIGHT 3 |
56 | 56 | ||
57 | /* | ||
58 | * How many Beacon frames need to have been used in average signal strength | ||
59 | * before starting to indicate signal change events. | ||
60 | */ | ||
61 | #define IEEE80211_SIGNAL_AVE_MIN_COUNT 4 | ||
62 | |||
57 | #define TMR_RUNNING_TIMER 0 | 63 | #define TMR_RUNNING_TIMER 0 |
58 | #define TMR_RUNNING_CHANSW 1 | 64 | #define TMR_RUNNING_CHANSW 1 |
59 | 65 | ||
@@ -778,16 +784,17 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
778 | params.uapsd = uapsd; | 784 | params.uapsd = uapsd; |
779 | 785 | ||
780 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 786 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
781 | printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " | 787 | wiphy_debug(local->hw.wiphy, |
782 | "cWmin=%d cWmax=%d txop=%d uapsd=%d\n", | 788 | "WMM queue=%d aci=%d acm=%d aifs=%d " |
783 | wiphy_name(local->hw.wiphy), queue, aci, acm, | 789 | "cWmin=%d cWmax=%d txop=%d uapsd=%d\n", |
784 | params.aifs, params.cw_min, params.cw_max, params.txop, | 790 | queue, aci, acm, |
785 | params.uapsd); | 791 | params.aifs, params.cw_min, params.cw_max, |
792 | params.txop, params.uapsd); | ||
786 | #endif | 793 | #endif |
787 | if (drv_conf_tx(local, queue, ¶ms)) | 794 | if (drv_conf_tx(local, queue, ¶ms)) |
788 | printk(KERN_DEBUG "%s: failed to set TX queue " | 795 | wiphy_debug(local->hw.wiphy, |
789 | "parameters for queue %d\n", | 796 | "failed to set TX queue parameters for queue %d\n", |
790 | wiphy_name(local->hw.wiphy), queue); | 797 | queue); |
791 | } | 798 | } |
792 | 799 | ||
793 | /* enable WMM or activate new settings */ | 800 | /* enable WMM or activate new settings */ |
@@ -990,6 +997,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
990 | 997 | ||
991 | if (remove_sta) | 998 | if (remove_sta) |
992 | sta_info_destroy_addr(sdata, bssid); | 999 | sta_info_destroy_addr(sdata, bssid); |
1000 | |||
1001 | del_timer_sync(&sdata->u.mgd.conn_mon_timer); | ||
1002 | del_timer_sync(&sdata->u.mgd.bcn_mon_timer); | ||
1003 | del_timer_sync(&sdata->u.mgd.timer); | ||
1004 | del_timer_sync(&sdata->u.mgd.chswitch_timer); | ||
993 | } | 1005 | } |
994 | 1006 | ||
995 | void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | 1007 | void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, |
@@ -1547,15 +1559,18 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1547 | ifmgd->last_beacon_signal = rx_status->signal; | 1559 | ifmgd->last_beacon_signal = rx_status->signal; |
1548 | if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { | 1560 | if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { |
1549 | ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; | 1561 | ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; |
1550 | ifmgd->ave_beacon_signal = rx_status->signal; | 1562 | ifmgd->ave_beacon_signal = rx_status->signal * 16; |
1551 | ifmgd->last_cqm_event_signal = 0; | 1563 | ifmgd->last_cqm_event_signal = 0; |
1564 | ifmgd->count_beacon_signal = 1; | ||
1552 | } else { | 1565 | } else { |
1553 | ifmgd->ave_beacon_signal = | 1566 | ifmgd->ave_beacon_signal = |
1554 | (IEEE80211_SIGNAL_AVE_WEIGHT * rx_status->signal * 16 + | 1567 | (IEEE80211_SIGNAL_AVE_WEIGHT * rx_status->signal * 16 + |
1555 | (16 - IEEE80211_SIGNAL_AVE_WEIGHT) * | 1568 | (16 - IEEE80211_SIGNAL_AVE_WEIGHT) * |
1556 | ifmgd->ave_beacon_signal) / 16; | 1569 | ifmgd->ave_beacon_signal) / 16; |
1570 | ifmgd->count_beacon_signal++; | ||
1557 | } | 1571 | } |
1558 | if (bss_conf->cqm_rssi_thold && | 1572 | if (bss_conf->cqm_rssi_thold && |
1573 | ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && | ||
1559 | !(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) { | 1574 | !(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) { |
1560 | int sig = ifmgd->ave_beacon_signal / 16; | 1575 | int sig = ifmgd->ave_beacon_signal / 16; |
1561 | int last_event = ifmgd->last_cqm_event_signal; | 1576 | int last_event = ifmgd->last_cqm_event_signal; |
@@ -2261,6 +2276,9 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
2261 | else | 2276 | else |
2262 | ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; | 2277 | ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; |
2263 | 2278 | ||
2279 | sdata->control_port_protocol = req->crypto.control_port_ethertype; | ||
2280 | sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; | ||
2281 | |||
2264 | ieee80211_add_work(wk); | 2282 | ieee80211_add_work(wk); |
2265 | return 0; | 2283 | return 0; |
2266 | } | 2284 | } |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index c36b1911987a..eeacaa59380a 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -112,8 +112,10 @@ void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) | |||
112 | * used from user space controlled off-channel operations. | 112 | * used from user space controlled off-channel operations. |
113 | */ | 113 | */ |
114 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | 114 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
115 | sdata->vif.type != NL80211_IFTYPE_MONITOR) | 115 | sdata->vif.type != NL80211_IFTYPE_MONITOR) { |
116 | set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | ||
116 | netif_tx_stop_all_queues(sdata->dev); | 117 | netif_tx_stop_all_queues(sdata->dev); |
118 | } | ||
117 | } | 119 | } |
118 | mutex_unlock(&local->iflist_mtx); | 120 | mutex_unlock(&local->iflist_mtx); |
119 | } | 121 | } |
@@ -131,6 +133,7 @@ void ieee80211_offchannel_stop_station(struct ieee80211_local *local) | |||
131 | continue; | 133 | continue; |
132 | 134 | ||
133 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { | 135 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
136 | set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | ||
134 | netif_tx_stop_all_queues(sdata->dev); | 137 | netif_tx_stop_all_queues(sdata->dev); |
135 | if (sdata->u.mgd.associated) | 138 | if (sdata->u.mgd.associated) |
136 | ieee80211_offchannel_ps_enable(sdata); | 139 | ieee80211_offchannel_ps_enable(sdata); |
@@ -155,8 +158,20 @@ void ieee80211_offchannel_return(struct ieee80211_local *local, | |||
155 | ieee80211_offchannel_ps_disable(sdata); | 158 | ieee80211_offchannel_ps_disable(sdata); |
156 | } | 159 | } |
157 | 160 | ||
158 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 161 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { |
162 | clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | ||
163 | /* | ||
164 | * This may wake up queues even though the driver | ||
165 | * currently has them stopped. This is not very | ||
166 | * likely, since the driver won't have gotten any | ||
167 | * (or hardly any) new packets while we weren't | ||
168 | * on the right channel, and even if it happens | ||
169 | * it will at most lead to queueing up one more | ||
170 | * packet per queue in mac80211 rather than on | ||
171 | * the interface qdisc. | ||
172 | */ | ||
159 | netif_tx_wake_all_queues(sdata->dev); | 173 | netif_tx_wake_all_queues(sdata->dev); |
174 | } | ||
160 | 175 | ||
161 | /* re-enable beaconing */ | 176 | /* re-enable beaconing */ |
162 | if (enable_beaconing && | 177 | if (enable_beaconing && |
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index d287fde0431d..ce671dfd238c 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -12,7 +12,8 @@ int __ieee80211_suspend(struct ieee80211_hw *hw) | |||
12 | struct ieee80211_sub_if_data *sdata; | 12 | struct ieee80211_sub_if_data *sdata; |
13 | struct sta_info *sta; | 13 | struct sta_info *sta; |
14 | 14 | ||
15 | ieee80211_scan_cancel(local); | 15 | if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning))) |
16 | ieee80211_scan_cancel(local); | ||
16 | 17 | ||
17 | ieee80211_stop_queues_by_reason(hw, | 18 | ieee80211_stop_queues_by_reason(hw, |
18 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); | 19 | IEEE80211_QUEUE_STOP_REASON_SUSPEND); |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index be04d46110fe..4f772de2f213 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -368,8 +368,8 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | |||
368 | 368 | ||
369 | ref = rate_control_alloc(name, local); | 369 | ref = rate_control_alloc(name, local); |
370 | if (!ref) { | 370 | if (!ref) { |
371 | printk(KERN_WARNING "%s: Failed to select rate control " | 371 | wiphy_warn(local->hw.wiphy, |
372 | "algorithm\n", wiphy_name(local->hw.wiphy)); | 372 | "Failed to select rate control algorithm\n"); |
373 | return -ENOENT; | 373 | return -ENOENT; |
374 | } | 374 | } |
375 | 375 | ||
@@ -380,9 +380,8 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, | |||
380 | sta_info_flush(local, NULL); | 380 | sta_info_flush(local, NULL); |
381 | } | 381 | } |
382 | 382 | ||
383 | printk(KERN_DEBUG "%s: Selected rate control " | 383 | wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n", |
384 | "algorithm '%s'\n", wiphy_name(local->hw.wiphy), | 384 | ref->ops->name); |
385 | ref->ops->name); | ||
386 | 385 | ||
387 | return 0; | 386 | return 0; |
388 | } | 387 | } |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index aa41e382bbb3..ac205a33690f 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -605,10 +605,8 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, | |||
605 | 605 | ||
606 | #ifdef CONFIG_MAC80211_HT_DEBUG | 606 | #ifdef CONFIG_MAC80211_HT_DEBUG |
607 | if (net_ratelimit()) | 607 | if (net_ratelimit()) |
608 | printk(KERN_DEBUG "%s: release an RX reorder " | 608 | wiphy_debug(hw->wiphy, |
609 | "frame due to timeout on earlier " | 609 | "release an RX reorder frame due to timeout on earlier frames\n"); |
610 | "frames\n", | ||
611 | wiphy_name(hw->wiphy)); | ||
612 | #endif | 610 | #endif |
613 | ieee80211_release_reorder_frame(hw, tid_agg_rx, | 611 | ieee80211_release_reorder_frame(hw, tid_agg_rx, |
614 | j, frames); | 612 | j, frames); |
@@ -1002,6 +1000,12 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
1002 | case WLAN_CIPHER_SUITE_AES_CMAC: | 1000 | case WLAN_CIPHER_SUITE_AES_CMAC: |
1003 | result = ieee80211_crypto_aes_cmac_decrypt(rx); | 1001 | result = ieee80211_crypto_aes_cmac_decrypt(rx); |
1004 | break; | 1002 | break; |
1003 | default: | ||
1004 | /* | ||
1005 | * We can reach here only with HW-only algorithms | ||
1006 | * but why didn't it decrypt the frame?! | ||
1007 | */ | ||
1008 | return RX_DROP_UNUSABLE; | ||
1005 | } | 1009 | } |
1006 | 1010 | ||
1007 | /* either the frame has been decrypted or will be dropped */ | 1011 | /* either the frame has been decrypted or will be dropped */ |
@@ -1523,7 +1527,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | |||
1523 | * Allow EAPOL frames to us/the PAE group address regardless | 1527 | * Allow EAPOL frames to us/the PAE group address regardless |
1524 | * of whether the frame was encrypted or not. | 1528 | * of whether the frame was encrypted or not. |
1525 | */ | 1529 | */ |
1526 | if (ehdr->h_proto == htons(ETH_P_PAE) && | 1530 | if (ehdr->h_proto == rx->sdata->control_port_protocol && |
1527 | (compare_ether_addr(ehdr->h_dest, rx->sdata->vif.addr) == 0 || | 1531 | (compare_ether_addr(ehdr->h_dest, rx->sdata->vif.addr) == 0 || |
1528 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) | 1532 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) |
1529 | return true; | 1533 | return true; |
@@ -2481,6 +2485,11 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) | |||
2481 | { | 2485 | { |
2482 | struct sk_buff_head frames; | 2486 | struct sk_buff_head frames; |
2483 | struct ieee80211_rx_data rx = { }; | 2487 | struct ieee80211_rx_data rx = { }; |
2488 | struct tid_ampdu_rx *tid_agg_rx; | ||
2489 | |||
2490 | tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); | ||
2491 | if (!tid_agg_rx) | ||
2492 | return; | ||
2484 | 2493 | ||
2485 | __skb_queue_head_init(&frames); | 2494 | __skb_queue_head_init(&frames); |
2486 | 2495 | ||
@@ -2495,10 +2504,9 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) | |||
2495 | test_bit(SCAN_OFF_CHANNEL, &sta->local->scanning))) | 2504 | test_bit(SCAN_OFF_CHANNEL, &sta->local->scanning))) |
2496 | rx.flags |= IEEE80211_RX_IN_SCAN; | 2505 | rx.flags |= IEEE80211_RX_IN_SCAN; |
2497 | 2506 | ||
2498 | spin_lock(&sta->ampdu_mlme.tid_rx[tid]->reorder_lock); | 2507 | spin_lock(&tid_agg_rx->reorder_lock); |
2499 | ieee80211_sta_reorder_release(&sta->local->hw, | 2508 | ieee80211_sta_reorder_release(&sta->local->hw, tid_agg_rx, &frames); |
2500 | sta->ampdu_mlme.tid_rx[tid], &frames); | 2509 | spin_unlock(&tid_agg_rx->reorder_lock); |
2501 | spin_unlock(&sta->ampdu_mlme.tid_rx[tid]->reorder_lock); | ||
2502 | 2510 | ||
2503 | ieee80211_rx_handlers(&rx, &frames); | 2511 | ieee80211_rx_handlers(&rx, &frames); |
2504 | } | 2512 | } |
@@ -2698,10 +2706,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2698 | skb_new = skb_copy(skb, GFP_ATOMIC); | 2706 | skb_new = skb_copy(skb, GFP_ATOMIC); |
2699 | if (!skb_new) { | 2707 | if (!skb_new) { |
2700 | if (net_ratelimit()) | 2708 | if (net_ratelimit()) |
2701 | printk(KERN_DEBUG "%s: failed to copy " | 2709 | wiphy_debug(local->hw.wiphy, |
2702 | "multicast frame for %s\n", | 2710 | "failed to copy multicast frame for %s\n", |
2703 | wiphy_name(local->hw.wiphy), | 2711 | prev->name); |
2704 | prev->name); | ||
2705 | goto next; | 2712 | goto next; |
2706 | } | 2713 | } |
2707 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new); | 2714 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new); |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 31f233f7f51a..d60389ba9b95 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -248,13 +248,11 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local) | |||
248 | return true; | 248 | return true; |
249 | } | 249 | } |
250 | 250 | ||
251 | void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | 251 | static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) |
252 | { | 252 | { |
253 | struct ieee80211_local *local = hw_to_local(hw); | 253 | struct ieee80211_local *local = hw_to_local(hw); |
254 | bool was_hw_scan; | 254 | bool was_hw_scan; |
255 | 255 | ||
256 | trace_api_scan_completed(local, aborted); | ||
257 | |||
258 | mutex_lock(&local->mtx); | 256 | mutex_lock(&local->mtx); |
259 | 257 | ||
260 | /* | 258 | /* |
@@ -312,6 +310,18 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
312 | ieee80211_mesh_notify_scan_completed(local); | 310 | ieee80211_mesh_notify_scan_completed(local); |
313 | ieee80211_queue_work(&local->hw, &local->work_work); | 311 | ieee80211_queue_work(&local->hw, &local->work_work); |
314 | } | 312 | } |
313 | |||
314 | void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | ||
315 | { | ||
316 | struct ieee80211_local *local = hw_to_local(hw); | ||
317 | |||
318 | trace_api_scan_completed(local, aborted); | ||
319 | |||
320 | set_bit(SCAN_COMPLETED, &local->scanning); | ||
321 | if (aborted) | ||
322 | set_bit(SCAN_ABORTED, &local->scanning); | ||
323 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
324 | } | ||
315 | EXPORT_SYMBOL(ieee80211_scan_completed); | 325 | EXPORT_SYMBOL(ieee80211_scan_completed); |
316 | 326 | ||
317 | static int ieee80211_start_sw_scan(struct ieee80211_local *local) | 327 | static int ieee80211_start_sw_scan(struct ieee80211_local *local) |
@@ -449,7 +459,7 @@ static int ieee80211_scan_state_decision(struct ieee80211_local *local, | |||
449 | 459 | ||
450 | /* if no more bands/channels left, complete scan and advance to the idle state */ | 460 | /* if no more bands/channels left, complete scan and advance to the idle state */ |
451 | if (local->scan_channel_idx >= local->scan_req->n_channels) { | 461 | if (local->scan_channel_idx >= local->scan_req->n_channels) { |
452 | ieee80211_scan_completed(&local->hw, false); | 462 | __ieee80211_scan_completed(&local->hw, false); |
453 | return 1; | 463 | return 1; |
454 | } | 464 | } |
455 | 465 | ||
@@ -641,6 +651,14 @@ void ieee80211_scan_work(struct work_struct *work) | |||
641 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; | 651 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; |
642 | unsigned long next_delay = 0; | 652 | unsigned long next_delay = 0; |
643 | 653 | ||
654 | if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) { | ||
655 | bool aborted; | ||
656 | |||
657 | aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning); | ||
658 | __ieee80211_scan_completed(&local->hw, aborted); | ||
659 | return; | ||
660 | } | ||
661 | |||
644 | mutex_lock(&local->mtx); | 662 | mutex_lock(&local->mtx); |
645 | if (!sdata || !local->scan_req) { | 663 | if (!sdata || !local->scan_req) { |
646 | mutex_unlock(&local->mtx); | 664 | mutex_unlock(&local->mtx); |
@@ -651,7 +669,7 @@ void ieee80211_scan_work(struct work_struct *work) | |||
651 | int rc = drv_hw_scan(local, sdata, local->hw_scan_req); | 669 | int rc = drv_hw_scan(local, sdata, local->hw_scan_req); |
652 | mutex_unlock(&local->mtx); | 670 | mutex_unlock(&local->mtx); |
653 | if (rc) | 671 | if (rc) |
654 | ieee80211_scan_completed(&local->hw, true); | 672 | __ieee80211_scan_completed(&local->hw, true); |
655 | return; | 673 | return; |
656 | } | 674 | } |
657 | 675 | ||
@@ -666,7 +684,7 @@ void ieee80211_scan_work(struct work_struct *work) | |||
666 | mutex_unlock(&local->mtx); | 684 | mutex_unlock(&local->mtx); |
667 | 685 | ||
668 | if (rc) | 686 | if (rc) |
669 | ieee80211_scan_completed(&local->hw, true); | 687 | __ieee80211_scan_completed(&local->hw, true); |
670 | return; | 688 | return; |
671 | } | 689 | } |
672 | 690 | ||
@@ -676,7 +694,7 @@ void ieee80211_scan_work(struct work_struct *work) | |||
676 | * Avoid re-scheduling when the sdata is going away. | 694 | * Avoid re-scheduling when the sdata is going away. |
677 | */ | 695 | */ |
678 | if (!ieee80211_sdata_running(sdata)) { | 696 | if (!ieee80211_sdata_running(sdata)) { |
679 | ieee80211_scan_completed(&local->hw, true); | 697 | __ieee80211_scan_completed(&local->hw, true); |
680 | return; | 698 | return; |
681 | } | 699 | } |
682 | 700 | ||
@@ -783,5 +801,5 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) | |||
783 | mutex_unlock(&local->mtx); | 801 | mutex_unlock(&local->mtx); |
784 | 802 | ||
785 | if (abortscan) | 803 | if (abortscan) |
786 | ieee80211_scan_completed(&local->hw, true); | 804 | __ieee80211_scan_completed(&local->hw, true); |
787 | } | 805 | } |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 6d86f0c1ad04..687077e49dc6 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -174,8 +174,7 @@ static void __sta_info_free(struct ieee80211_local *local, | |||
174 | } | 174 | } |
175 | 175 | ||
176 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 176 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
177 | printk(KERN_DEBUG "%s: Destroyed STA %pM\n", | 177 | wiphy_debug(local->hw.wiphy, "Destroyed STA %pM\n", sta->sta.addr); |
178 | wiphy_name(local->hw.wiphy), sta->sta.addr); | ||
179 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 178 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
180 | 179 | ||
181 | kfree(sta); | 180 | kfree(sta); |
@@ -262,8 +261,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
262 | sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); | 261 | sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); |
263 | 262 | ||
264 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 263 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
265 | printk(KERN_DEBUG "%s: Allocated STA %pM\n", | 264 | wiphy_debug(local->hw.wiphy, "Allocated STA %pM\n", sta->sta.addr); |
266 | wiphy_name(local->hw.wiphy), sta->sta.addr); | ||
267 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 265 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
268 | 266 | ||
269 | #ifdef CONFIG_MAC80211_MESH | 267 | #ifdef CONFIG_MAC80211_MESH |
@@ -300,8 +298,9 @@ static int sta_info_finish_insert(struct sta_info *sta, bool async) | |||
300 | sta->uploaded = true; | 298 | sta->uploaded = true; |
301 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 299 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
302 | if (async) | 300 | if (async) |
303 | printk(KERN_DEBUG "%s: Finished adding IBSS STA %pM\n", | 301 | wiphy_debug(local->hw.wiphy, |
304 | wiphy_name(local->hw.wiphy), sta->sta.addr); | 302 | "Finished adding IBSS STA %pM\n", |
303 | sta->sta.addr); | ||
305 | #endif | 304 | #endif |
306 | } | 305 | } |
307 | 306 | ||
@@ -411,8 +410,8 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) | |||
411 | spin_unlock_irqrestore(&local->sta_lock, flags); | 410 | spin_unlock_irqrestore(&local->sta_lock, flags); |
412 | 411 | ||
413 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 412 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
414 | printk(KERN_DEBUG "%s: Added IBSS STA %pM\n", | 413 | wiphy_debug(local->hw.wiphy, "Added IBSS STA %pM\n", |
415 | wiphy_name(local->hw.wiphy), sta->sta.addr); | 414 | sta->sta.addr); |
416 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 415 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
417 | 416 | ||
418 | ieee80211_queue_work(&local->hw, &local->sta_finish_work); | 417 | ieee80211_queue_work(&local->hw, &local->sta_finish_work); |
@@ -459,8 +458,7 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) | |||
459 | } | 458 | } |
460 | 459 | ||
461 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 460 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
462 | printk(KERN_DEBUG "%s: Inserted STA %pM\n", | 461 | wiphy_debug(local->hw.wiphy, "Inserted STA %pM\n", sta->sta.addr); |
463 | wiphy_name(local->hw.wiphy), sta->sta.addr); | ||
464 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 462 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
465 | 463 | ||
466 | /* move reference to rcu-protected */ | 464 | /* move reference to rcu-protected */ |
@@ -690,8 +688,7 @@ static int __must_check __sta_info_destroy(struct sta_info *sta) | |||
690 | #endif | 688 | #endif |
691 | 689 | ||
692 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 690 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
693 | printk(KERN_DEBUG "%s: Removed STA %pM\n", | 691 | wiphy_debug(local->hw.wiphy, "Removed STA %pM\n", sta->sta.addr); |
694 | wiphy_name(local->hw.wiphy), sta->sta.addr); | ||
695 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 692 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
696 | cancel_work_sync(&sta->drv_unblock_wk); | 693 | cancel_work_sync(&sta->drv_unblock_wk); |
697 | 694 | ||
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 67a35841bef0..571b32bfc54c 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -114,11 +114,10 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
114 | 114 | ||
115 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 115 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
116 | if (net_ratelimit()) | 116 | if (net_ratelimit()) |
117 | printk(KERN_DEBUG "%s: dropped TX filtered frame, " | 117 | wiphy_debug(local->hw.wiphy, |
118 | "queue_len=%d PS=%d @%lu\n", | 118 | "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", |
119 | wiphy_name(local->hw.wiphy), | 119 | skb_queue_len(&sta->tx_filtered), |
120 | skb_queue_len(&sta->tx_filtered), | 120 | !!test_sta_flags(sta, WLAN_STA_PS_STA), jiffies); |
121 | !!test_sta_flags(sta, WLAN_STA_PS_STA), jiffies); | ||
122 | #endif | 121 | #endif |
123 | dev_kfree_skb(skb); | 122 | dev_kfree_skb(skb); |
124 | } | 123 | } |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index bc4fefc91663..ccf373788ce9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -351,8 +351,8 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
351 | 351 | ||
352 | local->total_ps_buffered = total; | 352 | local->total_ps_buffered = total; |
353 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 353 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
354 | printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", | 354 | wiphy_debug(local->hw.wiphy, "PS buffers full - purged %d frames\n", |
355 | wiphy_name(local->hw.wiphy), purged); | 355 | purged); |
356 | #endif | 356 | #endif |
357 | } | 357 | } |
358 | 358 | ||
@@ -509,6 +509,18 @@ ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx) | |||
509 | } | 509 | } |
510 | 510 | ||
511 | static ieee80211_tx_result debug_noinline | 511 | static ieee80211_tx_result debug_noinline |
512 | ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) | ||
513 | { | ||
514 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
515 | |||
516 | if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol && | ||
517 | tx->sdata->control_port_no_encrypt)) | ||
518 | info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | ||
519 | |||
520 | return TX_CONTINUE; | ||
521 | } | ||
522 | |||
523 | static ieee80211_tx_result debug_noinline | ||
512 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | 524 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) |
513 | { | 525 | { |
514 | struct ieee80211_key *key = NULL; | 526 | struct ieee80211_key *key = NULL; |
@@ -527,7 +539,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
527 | else if ((key = rcu_dereference(tx->sdata->default_key))) | 539 | else if ((key = rcu_dereference(tx->sdata->default_key))) |
528 | tx->key = key; | 540 | tx->key = key; |
529 | else if (tx->sdata->drop_unencrypted && | 541 | else if (tx->sdata->drop_unencrypted && |
530 | (tx->skb->protocol != cpu_to_be16(ETH_P_PAE)) && | 542 | (tx->skb->protocol != tx->sdata->control_port_protocol) && |
531 | !(info->flags & IEEE80211_TX_CTL_INJECTED) && | 543 | !(info->flags & IEEE80211_TX_CTL_INJECTED) && |
532 | (!ieee80211_is_robust_mgmt_frame(hdr) || | 544 | (!ieee80211_is_robust_mgmt_frame(hdr) || |
533 | (ieee80211_is_action(hdr->frame_control) && | 545 | (ieee80211_is_action(hdr->frame_control) && |
@@ -947,6 +959,8 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) | |||
947 | static ieee80211_tx_result debug_noinline | 959 | static ieee80211_tx_result debug_noinline |
948 | ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx) | 960 | ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx) |
949 | { | 961 | { |
962 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
963 | |||
950 | if (!tx->key) | 964 | if (!tx->key) |
951 | return TX_CONTINUE; | 965 | return TX_CONTINUE; |
952 | 966 | ||
@@ -960,10 +974,16 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx) | |||
960 | return ieee80211_crypto_ccmp_encrypt(tx); | 974 | return ieee80211_crypto_ccmp_encrypt(tx); |
961 | case WLAN_CIPHER_SUITE_AES_CMAC: | 975 | case WLAN_CIPHER_SUITE_AES_CMAC: |
962 | return ieee80211_crypto_aes_cmac_encrypt(tx); | 976 | return ieee80211_crypto_aes_cmac_encrypt(tx); |
977 | default: | ||
978 | /* handle hw-only algorithm */ | ||
979 | if (info->control.hw_key) { | ||
980 | ieee80211_tx_set_protected(tx); | ||
981 | return TX_CONTINUE; | ||
982 | } | ||
983 | break; | ||
984 | |||
963 | } | 985 | } |
964 | 986 | ||
965 | /* not reached */ | ||
966 | WARN_ON(1); | ||
967 | return TX_DROP; | 987 | return TX_DROP; |
968 | } | 988 | } |
969 | 989 | ||
@@ -1341,6 +1361,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) | |||
1341 | CALL_TXH(ieee80211_tx_h_dynamic_ps); | 1361 | CALL_TXH(ieee80211_tx_h_dynamic_ps); |
1342 | CALL_TXH(ieee80211_tx_h_check_assoc); | 1362 | CALL_TXH(ieee80211_tx_h_check_assoc); |
1343 | CALL_TXH(ieee80211_tx_h_ps_buf); | 1363 | CALL_TXH(ieee80211_tx_h_ps_buf); |
1364 | CALL_TXH(ieee80211_tx_h_check_control_port_protocol); | ||
1344 | CALL_TXH(ieee80211_tx_h_select_key); | 1365 | CALL_TXH(ieee80211_tx_h_select_key); |
1345 | if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) | 1366 | if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) |
1346 | CALL_TXH(ieee80211_tx_h_rate_ctrl); | 1367 | CALL_TXH(ieee80211_tx_h_rate_ctrl); |
@@ -1513,8 +1534,8 @@ static int ieee80211_skb_resize(struct ieee80211_local *local, | |||
1513 | I802_DEBUG_INC(local->tx_expand_skb_head); | 1534 | I802_DEBUG_INC(local->tx_expand_skb_head); |
1514 | 1535 | ||
1515 | if (pskb_expand_head(skb, head_need, tail_need, GFP_ATOMIC)) { | 1536 | if (pskb_expand_head(skb, head_need, tail_need, GFP_ATOMIC)) { |
1516 | printk(KERN_DEBUG "%s: failed to reallocate TX buffer\n", | 1537 | wiphy_debug(local->hw.wiphy, |
1517 | wiphy_name(local->hw.wiphy)); | 1538 | "failed to reallocate TX buffer\n"); |
1518 | return -ENOMEM; | 1539 | return -ENOMEM; |
1519 | } | 1540 | } |
1520 | 1541 | ||
@@ -1701,7 +1722,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1701 | u16 ethertype, hdrlen, meshhdrlen = 0; | 1722 | u16 ethertype, hdrlen, meshhdrlen = 0; |
1702 | __le16 fc; | 1723 | __le16 fc; |
1703 | struct ieee80211_hdr hdr; | 1724 | struct ieee80211_hdr hdr; |
1704 | struct ieee80211s_hdr mesh_hdr; | 1725 | struct ieee80211s_hdr mesh_hdr __maybe_unused; |
1705 | const u8 *encaps_data; | 1726 | const u8 *encaps_data; |
1706 | int encaps_len, skip_header_bytes; | 1727 | int encaps_len, skip_header_bytes; |
1707 | int nh_pos, h_pos; | 1728 | int nh_pos, h_pos; |
@@ -1818,7 +1839,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1818 | #endif | 1839 | #endif |
1819 | case NL80211_IFTYPE_STATION: | 1840 | case NL80211_IFTYPE_STATION: |
1820 | memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); | 1841 | memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); |
1821 | if (sdata->u.mgd.use_4addr && ethertype != ETH_P_PAE) { | 1842 | if (sdata->u.mgd.use_4addr && |
1843 | cpu_to_be16(ethertype) != sdata->control_port_protocol) { | ||
1822 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1844 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1823 | /* RA TA DA SA */ | 1845 | /* RA TA DA SA */ |
1824 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); | 1846 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
@@ -1871,7 +1893,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1871 | if (!ieee80211_vif_is_mesh(&sdata->vif) && | 1893 | if (!ieee80211_vif_is_mesh(&sdata->vif) && |
1872 | unlikely(!is_multicast_ether_addr(hdr.addr1) && | 1894 | unlikely(!is_multicast_ether_addr(hdr.addr1) && |
1873 | !(sta_flags & WLAN_STA_AUTHORIZED) && | 1895 | !(sta_flags & WLAN_STA_AUTHORIZED) && |
1874 | !(ethertype == ETH_P_PAE && | 1896 | !(cpu_to_be16(ethertype) == sdata->control_port_protocol && |
1875 | compare_ether_addr(sdata->vif.addr, | 1897 | compare_ether_addr(sdata->vif.addr, |
1876 | skb->data + ETH_ALEN) == 0))) { | 1898 | skb->data + ETH_ALEN) == 0))) { |
1877 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1899 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
@@ -2070,8 +2092,7 @@ void ieee80211_tx_pending(unsigned long data) | |||
2070 | 2092 | ||
2071 | if (skb_queue_empty(&local->pending[i])) | 2093 | if (skb_queue_empty(&local->pending[i])) |
2072 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | 2094 | list_for_each_entry_rcu(sdata, &local->interfaces, list) |
2073 | netif_tx_wake_queue( | 2095 | netif_wake_subqueue(sdata->dev, i); |
2074 | netdev_get_tx_queue(sdata->dev, i)); | ||
2075 | } | 2096 | } |
2076 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | 2097 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
2077 | 2098 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index cd2b485fed4f..bd40b11d5ab9 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -283,8 +283,11 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, | |||
283 | 283 | ||
284 | if (skb_queue_empty(&local->pending[queue])) { | 284 | if (skb_queue_empty(&local->pending[queue])) { |
285 | rcu_read_lock(); | 285 | rcu_read_lock(); |
286 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | 286 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
287 | netif_tx_wake_queue(netdev_get_tx_queue(sdata->dev, queue)); | 287 | if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) |
288 | continue; | ||
289 | netif_wake_subqueue(sdata->dev, queue); | ||
290 | } | ||
288 | rcu_read_unlock(); | 291 | rcu_read_unlock(); |
289 | } else | 292 | } else |
290 | tasklet_schedule(&local->tx_pending_tasklet); | 293 | tasklet_schedule(&local->tx_pending_tasklet); |
@@ -323,7 +326,7 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, | |||
323 | 326 | ||
324 | rcu_read_lock(); | 327 | rcu_read_lock(); |
325 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | 328 | list_for_each_entry_rcu(sdata, &local->interfaces, list) |
326 | netif_tx_stop_queue(netdev_get_tx_queue(sdata->dev, queue)); | 329 | netif_stop_subqueue(sdata->dev, queue); |
327 | rcu_read_unlock(); | 330 | rcu_read_unlock(); |
328 | } | 331 | } |
329 | 332 | ||
@@ -1308,7 +1311,7 @@ void ieee80211_recalc_smps(struct ieee80211_local *local, | |||
1308 | */ | 1311 | */ |
1309 | 1312 | ||
1310 | list_for_each_entry(sdata, &local->interfaces, list) { | 1313 | list_for_each_entry(sdata, &local->interfaces, list) { |
1311 | if (!netif_running(sdata->dev)) | 1314 | if (!ieee80211_sdata_running(sdata)) |
1312 | continue; | 1315 | continue; |
1313 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 1316 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1314 | goto set; | 1317 | goto set; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 927ffbd2aebc..85a23de7bff3 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -136,6 +136,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
136 | .len = sizeof(struct nl80211_sta_flag_update), | 136 | .len = sizeof(struct nl80211_sta_flag_update), |
137 | }, | 137 | }, |
138 | [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG }, | 138 | [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG }, |
139 | [NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 }, | ||
140 | [NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG }, | ||
139 | [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG }, | 141 | [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG }, |
140 | [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, | 142 | [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, |
141 | [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, | 143 | [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, |
@@ -474,6 +476,9 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
474 | NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, | 476 | NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, |
475 | dev->wiphy.max_num_pmkids); | 477 | dev->wiphy.max_num_pmkids); |
476 | 478 | ||
479 | if (dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) | ||
480 | NLA_PUT_FLAG(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE); | ||
481 | |||
477 | nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES); | 482 | nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES); |
478 | if (!nl_modes) | 483 | if (!nl_modes) |
479 | goto nla_put_failure; | 484 | goto nla_put_failure; |
@@ -636,6 +641,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
636 | nla_nest_end(msg, nl_ftypes); | 641 | nla_nest_end(msg, nl_ftypes); |
637 | } | 642 | } |
638 | 643 | ||
644 | nla_nest_end(msg, nl_ifs); | ||
645 | |||
639 | nl_ifs = nla_nest_start(msg, NL80211_ATTR_RX_FRAME_TYPES); | 646 | nl_ifs = nla_nest_start(msg, NL80211_ATTR_RX_FRAME_TYPES); |
640 | if (!nl_ifs) | 647 | if (!nl_ifs) |
641 | goto nla_put_failure; | 648 | goto nla_put_failure; |
@@ -3689,7 +3696,8 @@ unlock_rtnl: | |||
3689 | return err; | 3696 | return err; |
3690 | } | 3697 | } |
3691 | 3698 | ||
3692 | static int nl80211_crypto_settings(struct genl_info *info, | 3699 | static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, |
3700 | struct genl_info *info, | ||
3693 | struct cfg80211_crypto_settings *settings, | 3701 | struct cfg80211_crypto_settings *settings, |
3694 | int cipher_limit) | 3702 | int cipher_limit) |
3695 | { | 3703 | { |
@@ -3697,6 +3705,19 @@ static int nl80211_crypto_settings(struct genl_info *info, | |||
3697 | 3705 | ||
3698 | settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; | 3706 | settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; |
3699 | 3707 | ||
3708 | if (info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]) { | ||
3709 | u16 proto; | ||
3710 | proto = nla_get_u16( | ||
3711 | info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]); | ||
3712 | settings->control_port_ethertype = cpu_to_be16(proto); | ||
3713 | if (!(rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && | ||
3714 | proto != ETH_P_PAE) | ||
3715 | return -EINVAL; | ||
3716 | if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]) | ||
3717 | settings->control_port_no_encrypt = true; | ||
3718 | } else | ||
3719 | settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE); | ||
3720 | |||
3700 | if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { | 3721 | if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { |
3701 | void *data; | 3722 | void *data; |
3702 | int len, i; | 3723 | int len, i; |
@@ -3824,7 +3845,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
3824 | if (info->attrs[NL80211_ATTR_PREV_BSSID]) | 3845 | if (info->attrs[NL80211_ATTR_PREV_BSSID]) |
3825 | prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]); | 3846 | prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]); |
3826 | 3847 | ||
3827 | err = nl80211_crypto_settings(info, &crypto, 1); | 3848 | err = nl80211_crypto_settings(rdev, info, &crypto, 1); |
3828 | if (!err) | 3849 | if (!err) |
3829 | err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, | 3850 | err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, |
3830 | ssid, ssid_len, ie, ie_len, use_mfp, | 3851 | ssid, ssid_len, ie, ie_len, use_mfp, |
@@ -4301,7 +4322,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
4301 | 4322 | ||
4302 | connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; | 4323 | connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; |
4303 | 4324 | ||
4304 | err = nl80211_crypto_settings(info, &connect.crypto, | 4325 | err = nl80211_crypto_settings(rdev, info, &connect.crypto, |
4305 | NL80211_MAX_NR_CIPHER_SUITES); | 4326 | NL80211_MAX_NR_CIPHER_SUITES); |
4306 | if (err) | 4327 | if (err) |
4307 | return err; | 4328 | return err; |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 8d961cc4ae98..bca32eb8f446 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -183,7 +183,14 @@ int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, | |||
183 | return -EINVAL; | 183 | return -EINVAL; |
184 | break; | 184 | break; |
185 | default: | 185 | default: |
186 | return -EINVAL; | 186 | /* |
187 | * We don't know anything about this algorithm, | ||
188 | * allow using it -- but the driver must check | ||
189 | * all parameters! We still check below whether | ||
190 | * or not the driver supports this algorithm, | ||
191 | * of course. | ||
192 | */ | ||
193 | break; | ||
187 | } | 194 | } |
188 | 195 | ||
189 | if (params->seq) { | 196 | if (params->seq) { |
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index 0ef17bc42bac..40385936e286 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -611,7 +611,7 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev) | |||
611 | #endif | 611 | #endif |
612 | 612 | ||
613 | #ifdef CONFIG_CFG80211_WEXT | 613 | #ifdef CONFIG_CFG80211_WEXT |
614 | if (dev->ieee80211_ptr && dev->ieee80211_ptr && | 614 | if (dev->ieee80211_ptr && |
615 | dev->ieee80211_ptr->wiphy && | 615 | dev->ieee80211_ptr->wiphy && |
616 | dev->ieee80211_ptr->wiphy->wext && | 616 | dev->ieee80211_ptr->wiphy->wext && |
617 | dev->ieee80211_ptr->wiphy->wext->get_wireless_stats) | 617 | dev->ieee80211_ptr->wiphy->wext->get_wireless_stats) |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index 9818198add8a..6fffe62d7c25 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -197,6 +197,8 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
197 | wdev->wext.connect.ssid_len = len; | 197 | wdev->wext.connect.ssid_len = len; |
198 | 198 | ||
199 | wdev->wext.connect.crypto.control_port = false; | 199 | wdev->wext.connect.crypto.control_port = false; |
200 | wdev->wext.connect.crypto.control_port_ethertype = | ||
201 | cpu_to_be16(ETH_P_PAE); | ||
200 | 202 | ||
201 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 203 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
202 | out: | 204 | out: |