]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/iwlwifi/iwl-agn-rs.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / iwlwifi / iwl-agn-rs.c
index 3a2b81291d86846b8769a0d448b579727a36536b..27f50471aed8fd0f4e0349975705b6b06c9e9066 100644 (file)
@@ -19,7 +19,7 @@
  * file called LICENSE.
  *
  * Contact Information:
- * James P. Ketrenos <ipw2100-admin@linux.intel.com>
+ *  Intel Linux Wireless <ilw@linux.intel.com>
  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  *
  *****************************************************************************/
@@ -38,7 +38,6 @@
 #include "iwl-dev.h"
 #include "iwl-sta.h"
 #include "iwl-core.h"
-#include "iwl-helpers.h"
 
 #define RS_NAME "iwl-agn-rs"
 
@@ -837,6 +836,10 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
            (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
             hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) {
                IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate);
+               /* the last LQ command could failed so the LQ in ucode not
+                * the same in driver sync up
+                */
+               iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
                goto out;
        }
 
@@ -941,7 +944,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
        }
 
        /* See if there's a better rate or modulation mode to try. */
-       rs_rate_scale_perform(priv, hdr, sta, lq_sta);
+       if (sta && sta->supp_rates[sband->band])
+               rs_rate_scale_perform(priv, hdr, sta, lq_sta);
 out:
        return;
 }
@@ -2098,14 +2102,23 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct iwl_lq_sta *lq_sta = priv_sta;
        int rate_idx;
+       u64 mask_bit = 0;
 
        IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
 
+       if (sta)
+               mask_bit = sta->supp_rates[sband->band];
+
        /* Send management frames and broadcast/multicast data using lowest
         * rate. */
        if (!ieee80211_is_data(hdr->frame_control) ||
            is_multicast_ether_addr(hdr->addr1) || !sta || !lq_sta) {
-               info->control.rates[0].idx = rate_lowest_index(sband, sta);
+               if (!mask_bit)
+                       info->control.rates[0].idx =
+                                       rate_lowest_index(sband, NULL);
+               else
+                       info->control.rates[0].idx =
+                                       rate_lowest_index(sband, sta);
                return;
        }
 
@@ -2168,6 +2181,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        struct iwl_priv *priv = (struct iwl_priv *)priv_r;
        struct ieee80211_conf *conf = &priv->hw->conf;
        struct iwl_lq_sta *lq_sta = priv_sta;
+       u16 mask_bit = 0;
 
        lq_sta->flush_timer = 0;
        lq_sta->supp_rates = sta->supp_rates[sband->band];
@@ -2201,16 +2215,6 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
                priv->assoc_station_added = 1;
        }
 
-       /* Find highest tx rate supported by hardware and destination station */
-       lq_sta->last_txrate_idx = 3;
-       for (i = 0; i < sband->n_bitrates; i++)
-               if (sta->supp_rates[sband->band] & BIT(i))
-                       lq_sta->last_txrate_idx = i;
-
-       /* For MODE_IEEE80211A, skip over cck rates in global rate table */
-       if (sband->band == IEEE80211_BAND_5GHZ)
-               lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
-
        lq_sta->is_dup = 0;
        lq_sta->is_green = rs_use_green(priv, conf);
        lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000);
@@ -2249,6 +2253,17 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
        lq_sta->drv = priv;
 
+       /* Find highest tx rate supported by hardware and destination station */
+       mask_bit = sta->supp_rates[sband->band] & lq_sta->active_legacy_rate;
+       lq_sta->last_txrate_idx = 3;
+       for (i = 0; i < sband->n_bitrates; i++)
+               if (mask_bit & BIT(i))
+                       lq_sta->last_txrate_idx = i;
+
+       /* For MODE_IEEE80211A, skip over cck rates in global rate table */
+       if (sband->band == IEEE80211_BAND_5GHZ)
+               lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
+
        rs_initialize_lq(priv, conf, sta, lq_sta);
 }