iwlwifi: Cancel scanning upon association
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / iwlwifi / iwl4965-base.c
index 2ed69376c96e45b359a52194b9506f99a5c50f93..5005c9513007671aa5dcfe9dd0d3cb379d990dc5 100644 (file)
@@ -45,6 +45,7 @@
 
 #include <asm/div64.h>
 
+#include "iwl-core.h"
 #include "iwl-4965.h"
 #include "iwl-helpers.h"
 
@@ -94,11 +95,6 @@ int iwl4965_param_amsdu_size_8K;   /* def: enable 8K amsdu size */
 #define DRV_COPYRIGHT  "Copyright(c) 2003-2007 Intel Corporation"
 #define DRV_VERSION     IWLWIFI_VERSION
 
-/* Change firmware file name, using "-" and incrementing number,
- *   *only* when uCode interface or architecture changes so that it
- *   is not compatible with earlier drivers.
- * This number will also appear in << 8 position of 1st dword of uCode file */
-#define IWL4965_UCODE_API "-1"
 
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
 MODULE_VERSION(DRV_VERSION);
@@ -3410,9 +3406,9 @@ static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv,
                tx_status->control.flags &= ~IEEE80211_TXCTL_AMPDU;
                tx_status->flags = iwl4965_is_tx_success(status)?
                        IEEE80211_TX_STATUS_ACK : 0;
-               /* FIXME Wrong Rate
-               tx_status->control.tx_rate =
-                               iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags); */
+               iwl4965_hwrate_to_tx_control(priv,
+                                            le32_to_cpu(tx_resp->rate_n_flags),
+                                            &tx_status->control);
                /* FIXME: code repetition end */
 
                IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
@@ -3569,9 +3565,10 @@ static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv,
        tx_status->queue_number = status;
        tx_status->queue_length = tx_resp->bt_kill_count;
        tx_status->queue_length |= tx_resp->failure_rts;
-
        tx_status->flags =
            iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0;
+       iwl4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
+                                    &tx_status->control);
 
        IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x "
                     "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status),
@@ -4917,9 +4914,9 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv)
         * atomic, make sure that inta covers all the interrupts that
         * we've discovered, even if FH interrupt came in just after
         * reading CSR_INT. */
-       if (inta_fh & CSR_FH_INT_RX_MASK)
+       if (inta_fh & CSR49_FH_INT_RX_MASK)
                inta |= CSR_INT_BIT_FH_RX;
-       if (inta_fh & CSR_FH_INT_TX_MASK)
+       if (inta_fh & CSR49_FH_INT_TX_MASK)
                inta |= CSR_INT_BIT_FH_TX;
 
        /* Now service all interrupt bits discovered above. */
@@ -5662,12 +5659,13 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv)
                                 geo_ch->flags);
        }
 
-       if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) {
+       if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
+            priv->cfg->sku & IWL_SKU_A) {
                printk(KERN_INFO DRV_NAME
                       ": Incorrectly detected BG card as ABG.  Please send "
                       "your PCI ID 0x%04X:0x%04X to maintainer.\n",
                       priv->pci_dev->device, priv->pci_dev->subsystem_device);
-               priv->is_abg = 0;
+               priv->cfg->sku &= ~IWL_SKU_A;
        }
 
        printk(KERN_INFO DRV_NAME
@@ -6016,7 +6014,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv)
        struct iwl4965_ucode *ucode;
        int ret;
        const struct firmware *ucode_raw;
-       const char *name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode";
+       const char *name = priv->cfg->fw_name;
        u8 *src;
        size_t len;
        u32 ver, inst_size, data_size, init_size, init_data_size, boot_size;
@@ -7426,6 +7424,12 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw,
        if (conf == NULL)
                return -EIO;
 
+       if (priv->vif != vif) {
+               IWL_DEBUG_MAC80211("leave - priv->vif != vif\n");
+               mutex_unlock(&priv->mutex);
+               return 0;
+       }
+
        if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) &&
            (!conf->beacon || !conf->ssid_len)) {
                IWL_DEBUG_MAC80211
@@ -7448,17 +7452,6 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw,
        if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) &&
            !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) {
  */
-       if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
-               IWL_DEBUG_MAC80211("leave - scanning\n");
-               mutex_unlock(&priv->mutex);
-               return 0;
-       }
-
-       if (priv->vif != vif) {
-               IWL_DEBUG_MAC80211("leave - priv->vif != vif\n");
-               mutex_unlock(&priv->mutex);
-               return 0;
-       }
 
        if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
                if (!conf->bssid) {
@@ -7957,15 +7950,21 @@ static void iwl4965_ht_info_fill(struct ieee80211_conf *conf,
        iwl_conf->is_green_field = !!(ht_conf->cap & IEEE80211_HT_CAP_GRN_FLD);
        iwl_conf->max_amsdu_size =
                !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU);
+
        iwl_conf->supported_chan_width =
                !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH);
+       iwl_conf->extension_chan_offset =
+               ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET;
+       /* If no above or below channel supplied disable FAT channel */
+       if (iwl_conf->extension_chan_offset != IWL_EXT_CHANNEL_OFFSET_ABOVE &&
+           iwl_conf->extension_chan_offset != IWL_EXT_CHANNEL_OFFSET_BELOW)
+               iwl_conf->supported_chan_width = 0;
+
        iwl_conf->tx_mimo_ps_mode =
                (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2);
        memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16);
 
        iwl_conf->control_channel = ht_bss_conf->primary_channel;
-       iwl_conf->extension_chan_offset =
-               ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_SEC_OFFSET;
        iwl_conf->tx_chan_width =
                !!(ht_bss_conf->bss_cap & IEEE80211_HT_IE_CHA_WIDTH);
        iwl_conf->ht_protection =
@@ -8606,6 +8605,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        int err = 0;
        struct iwl4965_priv *priv;
        struct ieee80211_hw *hw;
+       struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
        int i;
        DECLARE_MAC_BUF(mac);
 
@@ -8639,6 +8639,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
        priv = hw->priv;
        priv->hw = hw;
+       priv->cfg = cfg;
 
        priv->pci_dev = pdev;
        priv->antenna = (enum iwl4965_antenna)iwl4965_param_antenna;
@@ -8741,8 +8742,9 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        /* Choose which receivers/antennas to use */
        iwl4965_set_rxon_chain(priv);
 
+
        printk(KERN_INFO DRV_NAME
-              ": Detected Intel Wireless WiFi Link 4965AGN\n");
+               ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name);
 
        /* Device-specific setup */
        if (iwl4965_hw_set_hw_setting(priv)) {