aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-08 19:59:05 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-08 19:59:05 -0400
commit17dce5dfe38ae2fb359b61e855f5d8a3a8b7892b (patch)
tree88bb1fcf84f9ebfa4299c9a8dcd9e6330b358446 /drivers/net/wireless
parent712d6954e3998d0de2840d8130941e8042541246 (diff)
parent82a28c794f27aac17d7a3ebd7f14d731a11a5532 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: net/mac80211/mlme.c
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath9k/hw.c8
-rw-r--r--drivers/net/wireless/ath9k/main.c6
-rw-r--r--drivers/net/wireless/ath9k/recv.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c35
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c77
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fh.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c29
-rw-r--r--drivers/net/wireless/libertas/if_cs.c13
-rw-r--r--drivers/net/wireless/orinoco.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00reg.h5
16 files changed, 126 insertions, 92 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 2578411c6019..4ccbbc07cf1e 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -7236,15 +7236,15 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
7236 } 7236 }
7237 break; 7237 break;
7238 case ATH9K_CIPHER_WEP: 7238 case ATH9K_CIPHER_WEP:
7239 if (k->kv_len < 40 / NBBY) { 7239 if (k->kv_len < LEN_WEP40) {
7240 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7240 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
7241 "%s: WEP key length %u too small\n", 7241 "%s: WEP key length %u too small\n",
7242 __func__, k->kv_len); 7242 __func__, k->kv_len);
7243 return false; 7243 return false;
7244 } 7244 }
7245 if (k->kv_len <= 40 / NBBY) 7245 if (k->kv_len <= LEN_WEP40)
7246 keyType = AR_KEYTABLE_TYPE_40; 7246 keyType = AR_KEYTABLE_TYPE_40;
7247 else if (k->kv_len <= 104 / NBBY) 7247 else if (k->kv_len <= LEN_WEP104)
7248 keyType = AR_KEYTABLE_TYPE_104; 7248 keyType = AR_KEYTABLE_TYPE_104;
7249 else 7249 else
7250 keyType = AR_KEYTABLE_TYPE_128; 7250 keyType = AR_KEYTABLE_TYPE_128;
@@ -7264,7 +7264,7 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
7264 key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask; 7264 key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask;
7265 key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff; 7265 key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff;
7266 key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask; 7266 key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask;
7267 if (k->kv_len <= 104 / NBBY) 7267 if (k->kv_len <= LEN_WEP104)
7268 key4 &= 0xff; 7268 key4 &= 0xff;
7269 7269
7270 if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) { 7270 if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) {
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 39a4a70d0130..245b7308a9ad 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -204,7 +204,8 @@ static int ath_key_config(struct ath_softc *sc,
204 if (!ret) 204 if (!ret)
205 return -EIO; 205 return -EIO;
206 206
207 sc->sc_keytype = hk.kv_type; 207 if (mac)
208 sc->sc_keytype = hk.kv_type;
208 return 0; 209 return 0;
209} 210}
210 211
@@ -781,7 +782,8 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
781 key->hw_key_idx = key->keyidx; 782 key->hw_key_idx = key->keyidx;
782 /* push IV and Michael MIC generation to stack */ 783 /* push IV and Michael MIC generation to stack */
783 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 784 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
784 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 785 if (key->alg == ALG_TKIP)
786 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
785 } 787 }
786 break; 788 break;
787 case DISABLE_KEY: 789 case DISABLE_KEY:
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 6e13c638cc0b..498256309ab7 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -360,8 +360,9 @@ static void ath_rx_flush_tid(struct ath_softc *sc,
360 struct ath_arx_tid *rxtid, int drop) 360 struct ath_arx_tid *rxtid, int drop)
361{ 361{
362 struct ath_rxbuf *rxbuf; 362 struct ath_rxbuf *rxbuf;
363 unsigned long flag;
363 364
364 spin_lock_bh(&rxtid->tidlock); 365 spin_lock_irqsave(&rxtid->tidlock, flag);
365 while (rxtid->baw_head != rxtid->baw_tail) { 366 while (rxtid->baw_head != rxtid->baw_tail) {
366 rxbuf = rxtid->rxbuf + rxtid->baw_head; 367 rxbuf = rxtid->rxbuf + rxtid->baw_head;
367 if (!rxbuf->rx_wbuf) { 368 if (!rxbuf->rx_wbuf) {
@@ -382,7 +383,7 @@ static void ath_rx_flush_tid(struct ath_softc *sc,
382 INCR(rxtid->baw_head, ATH_TID_MAX_BUFS); 383 INCR(rxtid->baw_head, ATH_TID_MAX_BUFS);
383 INCR(rxtid->seq_next, IEEE80211_SEQ_MAX); 384 INCR(rxtid->seq_next, IEEE80211_SEQ_MAX);
384 } 385 }
385 spin_unlock_bh(&rxtid->tidlock); 386 spin_unlock_irqrestore(&rxtid->tidlock, flag);
386} 387}
387 388
388static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, 389static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 46e076af8f7e..d9c4fdbf7f77 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -474,8 +474,8 @@ static void iwl4965_apm_stop(struct iwl_priv *priv)
474 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 474 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
475 475
476 udelay(10); 476 udelay(10);
477 477 /* clear "init complete" move adapter D0A* --> D0U state */
478 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 478 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
479 spin_unlock_irqrestore(&priv->lock, flags); 479 spin_unlock_irqrestore(&priv->lock, flags);
480} 480}
481 481
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index ef9d3399dfd2..cccd84c2f8ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -145,7 +145,8 @@ static void iwl5000_apm_stop(struct iwl_priv *priv)
145 145
146 udelay(10); 146 udelay(10);
147 147
148 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 148 /* clear "init complete" move adapter D0A* --> D0U state */
149 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
149 150
150 spin_unlock_irqrestore(&priv->lock, flags); 151 spin_unlock_irqrestore(&priv->lock, flags);
151} 152}
@@ -532,14 +533,11 @@ static int iwl5000_load_section(struct iwl_priv *priv,
532 FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), 533 FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
533 phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); 534 phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK);
534 535
535 /* FIME: write the MSB of the phy_addr in CTRL1
536 * iwl_write_direct32(priv,
537 IWL_FH_TFDIB_CTRL1_REG(IWL_FH_SRVC_CHNL),
538 ((phy_addr & MSB_MSK)
539 << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_count);
540 */
541 iwl_write_direct32(priv, 536 iwl_write_direct32(priv,
542 FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), byte_cnt); 537 FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL),
538 (iwl_get_dma_hi_address(phy_addr)
539 << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt);
540
543 iwl_write_direct32(priv, 541 iwl_write_direct32(priv,
544 FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), 542 FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
545 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | 543 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 35a6aeefaa25..98f2c843b99e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -1153,7 +1153,8 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1153 !sta->ht_info.ht_supported) 1153 !sta->ht_info.ht_supported)
1154 return -1; 1154 return -1;
1155 1155
1156 if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC) 1156 if (((sta->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS) >> 2)
1157 == IWL_MIMO_PS_STATIC)
1157 return -1; 1158 return -1;
1158 1159
1159 /* Need both Tx chains/antennas to support MIMO */ 1160 /* Need both Tx chains/antennas to support MIMO */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5cce894dc1f9..1547122e66fa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -181,14 +181,14 @@ static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
181} 181}
182 182
183/** 183/**
184 * iwl4965_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed 184 * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
185 * @priv: staging_rxon is compared to active_rxon 185 * @priv: staging_rxon is compared to active_rxon
186 * 186 *
187 * If the RXON structure is changing enough to require a new tune, 187 * If the RXON structure is changing enough to require a new tune,
188 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that 188 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
189 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. 189 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
190 */ 190 */
191static int iwl4965_full_rxon_required(struct iwl_priv *priv) 191static int iwl_full_rxon_required(struct iwl_priv *priv)
192{ 192{
193 193
194 /* These items are only settable from the full RXON command */ 194 /* These items are only settable from the full RXON command */
@@ -207,7 +207,6 @@ static int iwl4965_full_rxon_required(struct iwl_priv *priv)
207 priv->active_rxon.ofdm_ht_single_stream_basic_rates) || 207 priv->active_rxon.ofdm_ht_single_stream_basic_rates) ||
208 (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != 208 (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates !=
209 priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || 209 priv->active_rxon.ofdm_ht_dual_stream_basic_rates) ||
210 (priv->staging_rxon.rx_chain != priv->active_rxon.rx_chain) ||
211 (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) 210 (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
212 return 1; 211 return 1;
213 212
@@ -263,7 +262,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
263 /* If we don't need to send a full RXON, we can use 262 /* If we don't need to send a full RXON, we can use
264 * iwl4965_rxon_assoc_cmd which is used to reconfigure filter 263 * iwl4965_rxon_assoc_cmd which is used to reconfigure filter
265 * and other flags for the current radio configuration. */ 264 * and other flags for the current radio configuration. */
266 if (!iwl4965_full_rxon_required(priv)) { 265 if (!iwl_full_rxon_required(priv)) {
267 ret = iwl_send_rxon_assoc(priv); 266 ret = iwl_send_rxon_assoc(priv);
268 if (ret) { 267 if (ret) {
269 IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret); 268 IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret);
@@ -587,8 +586,6 @@ static void iwl4965_ht_conf(struct iwl_priv *priv,
587 iwl_conf->supported_chan_width = 0; 586 iwl_conf->supported_chan_width = 0;
588 } 587 }
589 588
590 iwl_conf->tx_mimo_ps_mode =
591 (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2);
592 memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); 589 memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16);
593 590
594 iwl_conf->control_channel = ht_bss_conf->primary_channel; 591 iwl_conf->control_channel = ht_bss_conf->primary_channel;
@@ -2190,7 +2187,10 @@ static void __iwl4965_down(struct iwl_priv *priv)
2190 udelay(5); 2187 udelay(5);
2191 2188
2192 /* FIXME: apm_ops.suspend(priv) */ 2189 /* FIXME: apm_ops.suspend(priv) */
2193 priv->cfg->ops->lib->apm_ops.reset(priv); 2190 if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status))
2191 priv->cfg->ops->lib->apm_ops.stop(priv);
2192 else
2193 priv->cfg->ops->lib->apm_ops.reset(priv);
2194 priv->cfg->ops->lib->free_shared_mem(priv); 2194 priv->cfg->ops->lib->free_shared_mem(priv);
2195 2195
2196 exit: 2196 exit:
@@ -2604,6 +2604,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2604{ 2604{
2605 struct iwl_priv *priv = hw->priv; 2605 struct iwl_priv *priv = hw->priv;
2606 int ret; 2606 int ret;
2607 u16 pci_cmd;
2607 2608
2608 IWL_DEBUG_MAC80211("enter\n"); 2609 IWL_DEBUG_MAC80211("enter\n");
2609 2610
@@ -2614,6 +2615,13 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2614 pci_restore_state(priv->pci_dev); 2615 pci_restore_state(priv->pci_dev);
2615 pci_enable_msi(priv->pci_dev); 2616 pci_enable_msi(priv->pci_dev);
2616 2617
2618 /* enable interrupts if needed: hw bug w/a */
2619 pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
2620 if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
2621 pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
2622 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
2623 }
2624
2617 ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, 2625 ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED,
2618 DRV_NAME, priv); 2626 DRV_NAME, priv);
2619 if (ret) { 2627 if (ret) {
@@ -3583,7 +3591,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
3583 3591
3584 priv->assoc_id = 0; 3592 priv->assoc_id = 0;
3585 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; 3593 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;
3586 priv->timestamp = le64_to_cpu(timestamp) + (priv->beacon_int * 1000); 3594 priv->timestamp = le64_to_cpu(timestamp);
3587 3595
3588 IWL_DEBUG_MAC80211("leave\n"); 3596 IWL_DEBUG_MAC80211("leave\n");
3589 spin_unlock_irqrestore(&priv->lock, flags); 3597 spin_unlock_irqrestore(&priv->lock, flags);
@@ -4385,15 +4393,18 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
4385 iwl_dbgfs_unregister(priv); 4393 iwl_dbgfs_unregister(priv);
4386 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); 4394 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
4387 4395
4396 /* ieee80211_unregister_hw call wil cause iwl4965_mac_stop to
4397 * to be called and iwl4965_down since we are removing the device
4398 * we need to set STATUS_EXIT_PENDING bit.
4399 */
4400 set_bit(STATUS_EXIT_PENDING, &priv->status);
4388 if (priv->mac80211_registered) { 4401 if (priv->mac80211_registered) {
4389 ieee80211_unregister_hw(priv->hw); 4402 ieee80211_unregister_hw(priv->hw);
4390 priv->mac80211_registered = 0; 4403 priv->mac80211_registered = 0;
4404 } else {
4405 iwl4965_down(priv);
4391 } 4406 }
4392 4407
4393 set_bit(STATUS_EXIT_PENDING, &priv->status);
4394
4395 iwl4965_down(priv);
4396
4397 /* make sure we flush any pending irq or 4408 /* make sure we flush any pending irq or
4398 * tasklet for the driver 4409 * tasklet for the driver
4399 */ 4410 */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 1c5406487b11..a0b86af25c83 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -592,12 +592,11 @@ static void iwlcore_free_geos(struct iwl_priv *priv)
592 clear_bit(STATUS_GEO_CONFIGURED, &priv->status); 592 clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
593} 593}
594 594
595static u8 is_single_rx_stream(struct iwl_priv *priv) 595static bool is_single_rx_stream(struct iwl_priv *priv)
596{ 596{
597 return !priv->current_ht_config.is_ht || 597 return !priv->current_ht_config.is_ht ||
598 ((priv->current_ht_config.supp_mcs_set[1] == 0) && 598 ((priv->current_ht_config.supp_mcs_set[1] == 0) &&
599 (priv->current_ht_config.supp_mcs_set[2] == 0)) || 599 (priv->current_ht_config.supp_mcs_set[2] == 0));
600 priv->ps_mode == IWL_MIMO_PS_STATIC;
601} 600}
602 601
603static u8 iwl_is_channel_extension(struct iwl_priv *priv, 602static u8 iwl_is_channel_extension(struct iwl_priv *priv,
@@ -704,33 +703,39 @@ EXPORT_SYMBOL(iwl_set_rxon_ht);
704 * MIMO (dual stream) requires at least 2, but works better with 3. 703 * MIMO (dual stream) requires at least 2, but works better with 3.
705 * This does not determine *which* chains to use, just how many. 704 * This does not determine *which* chains to use, just how many.
706 */ 705 */
707static int iwlcore_get_rx_chain_counter(struct iwl_priv *priv, 706static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
708 u8 *idle_state, u8 *rx_state)
709{ 707{
710 u8 is_single = is_single_rx_stream(priv); 708 bool is_single = is_single_rx_stream(priv);
711 u8 is_cam = test_bit(STATUS_POWER_PMI, &priv->status) ? 0 : 1; 709 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
712 710
713 /* # of Rx chains to use when expecting MIMO. */ 711 /* # of Rx chains to use when expecting MIMO. */
714 if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC))) 712 if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC)))
715 *rx_state = 2; 713 return 2;
716 else 714 else
717 *rx_state = 3; 715 return 3;
716}
718 717
718static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
719{
720 int idle_cnt;
721 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
719 /* # Rx chains when idling and maybe trying to save power */ 722 /* # Rx chains when idling and maybe trying to save power */
720 switch (priv->ps_mode) { 723 switch (priv->ps_mode) {
721 case IWL_MIMO_PS_STATIC: 724 case IWL_MIMO_PS_STATIC:
722 case IWL_MIMO_PS_DYNAMIC: 725 case IWL_MIMO_PS_DYNAMIC:
723 *idle_state = (is_cam) ? 2 : 1; 726 idle_cnt = (is_cam) ? 2 : 1;
724 break; 727 break;
725 case IWL_MIMO_PS_NONE: 728 case IWL_MIMO_PS_NONE:
726 *idle_state = (is_cam) ? *rx_state : 1; 729 idle_cnt = (is_cam) ? active_cnt : 1;
727 break; 730 break;
731 case IWL_MIMO_PS_INVALID:
728 default: 732 default:
729 *idle_state = 1; 733 IWL_ERROR("invalide mimo ps mode %d\n", priv->ps_mode);
734 WARN_ON(1);
735 idle_cnt = -1;
730 break; 736 break;
731 } 737 }
732 738 return idle_cnt;
733 return 0;
734} 739}
735 740
736/** 741/**
@@ -741,34 +746,44 @@ static int iwlcore_get_rx_chain_counter(struct iwl_priv *priv,
741 */ 746 */
742void iwl_set_rxon_chain(struct iwl_priv *priv) 747void iwl_set_rxon_chain(struct iwl_priv *priv)
743{ 748{
744 u8 is_single = is_single_rx_stream(priv); 749 bool is_single = is_single_rx_stream(priv);
745 u8 idle_state, rx_state; 750 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
746 751 u8 idle_rx_cnt, active_rx_cnt;
747 priv->staging_rxon.rx_chain = 0; 752 u16 rx_chain;
748 rx_state = idle_state = 3;
749 753
750 /* Tell uCode which antennas are actually connected. 754 /* Tell uCode which antennas are actually connected.
751 * Before first association, we assume all antennas are connected. 755 * Before first association, we assume all antennas are connected.
752 * Just after first association, iwl_chain_noise_calibration() 756 * Just after first association, iwl_chain_noise_calibration()
753 * checks which antennas actually *are* connected. */ 757 * checks which antennas actually *are* connected. */
754 priv->staging_rxon.rx_chain |= 758 rx_chain = priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
755 cpu_to_le16(priv->hw_params.valid_rx_ant <<
756 RXON_RX_CHAIN_VALID_POS);
757 759
758 /* How many receivers should we use? */ 760 /* How many receivers should we use? */
759 iwlcore_get_rx_chain_counter(priv, &idle_state, &rx_state); 761 active_rx_cnt = iwl_get_active_rx_chain_count(priv);
760 priv->staging_rxon.rx_chain |= 762 idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt);
761 cpu_to_le16(rx_state << RXON_RX_CHAIN_MIMO_CNT_POS); 763
762 priv->staging_rxon.rx_chain |= 764 /* correct rx chain count accoridng hw settings */
763 cpu_to_le16(idle_state << RXON_RX_CHAIN_CNT_POS); 765 if (priv->hw_params.rx_chains_num < active_rx_cnt)
764 766 active_rx_cnt = priv->hw_params.rx_chains_num;
765 if (!is_single && (rx_state >= 2) && 767
766 !test_bit(STATUS_POWER_PMI, &priv->status)) 768 if (priv->hw_params.rx_chains_num < idle_rx_cnt)
769 idle_rx_cnt = priv->hw_params.rx_chains_num;
770
771 rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS;
772 rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS;
773
774 priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain);
775
776 if (!is_single && (active_rx_cnt >= 2) && is_cam)
767 priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; 777 priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
768 else 778 else
769 priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; 779 priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
770 780
771 IWL_DEBUG_ASSOC("rx chain %X\n", priv->staging_rxon.rx_chain); 781 IWL_DEBUG_ASSOC("rx_chain=0x%Xi active=%d idle=%d\n",
782 priv->staging_rxon.rx_chain,
783 active_rx_cnt, idle_rx_cnt);
784
785 WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 ||
786 active_rx_cnt < idle_rx_cnt);
772} 787}
773EXPORT_SYMBOL(iwl_set_rxon_chain); 788EXPORT_SYMBOL(iwl_set_rxon_chain);
774 789
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 1943de3f7649..640ceea913c7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -406,7 +406,6 @@ struct iwl_ht_info {
406 /* self configuration data */ 406 /* self configuration data */
407 u8 is_ht; 407 u8 is_ht;
408 u8 supported_chan_width; 408 u8 supported_chan_width;
409 u16 tx_mimo_ps_mode;
410 u8 is_green_field; 409 u8 is_green_field;
411 u8 sgf; /* HT_SHORT_GI_* short guard interval */ 410 u8 sgf; /* HT_SHORT_GI_* short guard interval */
412 u8 max_amsdu_size; 411 u8 max_amsdu_size;
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index 944642450d3d..cd11c0ca2991 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -287,6 +287,7 @@
287 287
288#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) 288#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
289 289
290#define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28
290 291
291/** 292/**
292 * Transmit DMA Channel Control/Status Registers (TCSR) 293 * Transmit DMA Channel Control/Status Registers (TCSR)
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index b92a580ed2f9..faad4d3f56e1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -1068,7 +1068,10 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1068 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; 1068 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE;
1069 1069
1070 rx_status.flag = 0; 1070 rx_status.flag = 0;
1071 rx_status.flag |= RX_FLAG_TSFT; 1071
1072 /* TSF isn't reliable. In order to allow smooth user experience,
1073 * this W/A doesn't propagate it to the mac80211 */
1074 /*rx_status.flag |= RX_FLAG_TSFT;*/
1072 1075
1073 if ((unlikely(rx_start->cfg_phy_cnt > 20))) { 1076 if ((unlikely(rx_start->cfg_phy_cnt > 20))) {
1074 IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n", 1077 IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 9bb6adb28b73..6c8ac3a87d54 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -421,7 +421,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
421 else 421 else
422 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; 422 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
423 423
424 if ((scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) && n_probes) 424 if (n_probes)
425 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); 425 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
426 426
427 scan_ch->active_dwell = cpu_to_le16(active_dwell); 427 scan_ch->active_dwell = cpu_to_le16(active_dwell);
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 452938c299af..9d485aadef96 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -402,12 +402,11 @@ static int iwl_hw_tx_queue_init(struct iwl_priv *priv,
402/** 402/**
403 * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue 403 * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue
404 */ 404 */
405static int iwl_tx_queue_init(struct iwl_priv *priv, 405static int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
406 struct iwl_tx_queue *txq,
407 int slots_num, u32 txq_id) 406 int slots_num, u32 txq_id)
408{ 407{
409 int i, len; 408 int i, len;
410 int rc = 0; 409 int ret;
411 410
412 /* 411 /*
413 * Alloc buffer array for commands (Tx or other types of commands). 412 * Alloc buffer array for commands (Tx or other types of commands).
@@ -426,19 +425,16 @@ static int iwl_tx_queue_init(struct iwl_priv *priv,
426 continue; 425 continue;
427 } 426 }
428 427
429 txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); 428 txq->cmd[i] = kmalloc(len, GFP_KERNEL);
430 if (!txq->cmd[i]) 429 if (!txq->cmd[i])
431 return -ENOMEM; 430 goto err;
432 } 431 }
433 432
434 /* Alloc driver data array and TFD circular buffer */ 433 /* Alloc driver data array and TFD circular buffer */
435 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 434 ret = iwl_tx_queue_alloc(priv, txq, txq_id);
436 if (rc) { 435 if (ret)
437 for (i = 0; i < slots_num; i++) 436 goto err;
438 kfree(txq->cmd[i]);
439 437
440 return -ENOMEM;
441 }
442 txq->need_update = 0; 438 txq->need_update = 0;
443 439
444 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 440 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
@@ -452,6 +448,17 @@ static int iwl_tx_queue_init(struct iwl_priv *priv,
452 iwl_hw_tx_queue_init(priv, txq); 448 iwl_hw_tx_queue_init(priv, txq);
453 449
454 return 0; 450 return 0;
451err:
452 for (i = 0; i < slots_num; i++) {
453 kfree(txq->cmd[i]);
454 txq->cmd[i] = NULL;
455 }
456
457 if (txq_id == IWL_CMD_QUEUE_NUM) {
458 kfree(txq->cmd[slots_num]);
459 txq->cmd[slots_num] = NULL;
460 }
461 return -ENOMEM;
455} 462}
456/** 463/**
457 * iwl_hw_txq_ctx_free - Free TXQ Context 464 * iwl_hw_txq_ctx_free - Free TXQ Context
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 92837a2dd6d5..e3505c110af6 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -595,7 +595,7 @@ static int if_cs_prog_helper(struct if_cs_card *card)
595 if (ret < 0) { 595 if (ret < 0) {
596 lbs_pr_err("can't download helper at 0x%x, ret %d\n", 596 lbs_pr_err("can't download helper at 0x%x, ret %d\n",
597 sent, ret); 597 sent, ret);
598 goto done; 598 goto err_release;
599 } 599 }
600 600
601 if (count == 0) 601 if (count == 0)
@@ -604,9 +604,8 @@ static int if_cs_prog_helper(struct if_cs_card *card)
604 sent += count; 604 sent += count;
605 } 605 }
606 606
607err_release:
607 release_firmware(fw); 608 release_firmware(fw);
608 ret = 0;
609
610done: 609done:
611 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); 610 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
612 return ret; 611 return ret;
@@ -676,14 +675,8 @@ static int if_cs_prog_real(struct if_cs_card *card)
676 } 675 }
677 676
678 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); 677 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a);
679 if (ret < 0) { 678 if (ret < 0)
680 lbs_pr_err("firmware download failed\n"); 679 lbs_pr_err("firmware download failed\n");
681 goto err_release;
682 }
683
684 ret = 0;
685 goto done;
686
687 680
688err_release: 681err_release:
689 release_firmware(fw); 682 release_firmware(fw);
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 6a196c31de43..ec0451cbb8e1 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -2833,6 +2833,9 @@ __orinoco_set_multicast_list(struct net_device *dev)
2833 priv->promiscuous = promisc; 2833 priv->promiscuous = promisc;
2834 } 2834 }
2835 2835
2836 /* If we're not in promiscuous mode, then we need to set the
2837 * group address if either we want to multicast, or if we were
2838 * multicasting and want to stop */
2836 if (! promisc && (mc_count || priv->mc_count) ) { 2839 if (! promisc && (mc_count || priv->mc_count) ) {
2837 struct dev_mc_list *p = dev->mc_list; 2840 struct dev_mc_list *p = dev->mc_list;
2838 struct hermes_multicast mclist; 2841 struct hermes_multicast mclist;
@@ -2852,9 +2855,10 @@ __orinoco_set_multicast_list(struct net_device *dev)
2852 printk(KERN_WARNING "%s: Multicast list is " 2855 printk(KERN_WARNING "%s: Multicast list is "
2853 "longer than mc_count\n", dev->name); 2856 "longer than mc_count\n", dev->name);
2854 2857
2855 err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFGROUPADDRESSES, 2858 err = hermes_write_ltv(hw, USER_BAP,
2856 HERMES_BYTES_TO_RECLEN(priv->mc_count * ETH_ALEN), 2859 HERMES_RID_CNFGROUPADDRESSES,
2857 &mclist); 2860 HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN),
2861 &mclist);
2858 if (err) 2862 if (err)
2859 printk(KERN_ERR "%s: Error %d setting multicast list.\n", 2863 printk(KERN_ERR "%s: Error %d setting multicast list.\n",
2860 dev->name, err); 2864 dev->name, err);
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 6d5acf99a1c5..c2fba7c9f05c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -153,7 +153,7 @@ struct rt2x00_field32 {
153 */ 153 */
154#define is_power_of_two(x) ( !((x) & ((x)-1)) ) 154#define is_power_of_two(x) ( !((x) & ((x)-1)) )
155#define low_bit_mask(x) ( ((x)-1) & ~(x) ) 155#define low_bit_mask(x) ( ((x)-1) & ~(x) )
156#define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) 156#define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x))
157 157
158/* 158/*
159 * Macro's to find first set bit in a variable. 159 * Macro's to find first set bit in a variable.
@@ -190,8 +190,7 @@ struct rt2x00_field32 {
190 * does not exceed the given typelimit. 190 * does not exceed the given typelimit.
191 */ 191 */
192#define FIELD_CHECK(__mask, __type) \ 192#define FIELD_CHECK(__mask, __type) \
193 BUILD_BUG_ON(!__builtin_constant_p(__mask) || \ 193 BUILD_BUG_ON(!(__mask) || \
194 !(__mask) || \
195 !is_valid_mask(__mask) || \ 194 !is_valid_mask(__mask) || \
196 (__mask) != (__type)(__mask)) \ 195 (__mask) != (__type)(__mask)) \
197 196