iwlwifi: calculate active legacy rates per station
authorJohannes Berg <johannes.berg@intel.com>
Thu, 8 Mar 2012 08:18:04 +0000 (09:18 +0100)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Thu, 12 Apr 2012 21:18:19 +0000 (14:18 -0700)
Not all stations are guaranteed to have the same
active (available) legacy rates, so calculate them
on rate control init instead of hard-coding them
based on our own available rates. I have no idea
why that was done here before.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-dev.h

index 08419e833c4d6572e5a35b442c87b7255b7cd423..8b13b6cf940ad4c144a44e4eecae3ee67a98f5aa 100644 (file)
@@ -2826,6 +2826,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
        struct iwl_station_priv *sta_priv;
        struct iwl_lq_sta *lq_sta;
        struct ieee80211_supported_band *sband;
+       unsigned long supp; /* must be unsigned long for for_each_set_bit */
 
        sta_priv = (struct iwl_station_priv *) sta->drv_priv;
        lq_sta = &sta_priv->lq_sta;
@@ -2855,8 +2856,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
        lq_sta->max_rate_idx = -1;
        lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX;
        lq_sta->is_green = rs_use_green(sta);
-       lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000);
-       lq_sta->band = priv->band;
+       lq_sta->band = sband->band;
+       /*
+        * active legacy rates as per supported rates bitmap
+        */
+       supp = sta->supp_rates[sband->band];
+       lq_sta->active_legacy_rate = 0;
+       for_each_set_bit(i, &supp, BITS_PER_LONG)
+               lq_sta->active_legacy_rate |= BIT(sband->bitrates[i].hw_value);
+
        /*
         * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3),
         * supp_rates[] does not; shift to convert format, force 9 MBits off.
index b507ee69b3bbf4710020a813b84854e92e293c97..208b827ce9f924df8f89e6dd0274b4bfd7971264 100644 (file)
@@ -790,8 +790,6 @@ int iwl_alive_start(struct iwl_priv *priv)
 
        ieee80211_wake_queues(priv->hw);
 
-       priv->active_rate = IWL_RATES_MASK;
-
        /* Configure Tx antenna selection based on H/W config */
        iwlagn_send_tx_ant_config(priv, priv->hw_params.valid_tx_ant);
 
index 6a02ade07a24125cdded1b9e20a46ce1c333e9d0..0f86f1c323aac134e79d9d3f69457cabfc6cd4ea 100644 (file)
@@ -287,26 +287,7 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv,
 
 void iwl_set_rate(struct iwl_priv *priv)
 {
-       const struct ieee80211_supported_band *hw = NULL;
-       struct ieee80211_rate *rate;
        struct iwl_rxon_context *ctx;
-       int i;
-
-       hw = iwl_get_hw_mode(priv, priv->band);
-       if (!hw) {
-               IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
-               return;
-       }
-
-       priv->active_rate = 0;
-
-       for (i = 0; i < hw->n_bitrates; i++) {
-               rate = &(hw->bitrates[i]);
-               if (rate->hw_value < IWL_RATE_COUNT_LEGACY)
-                       priv->active_rate |= (1 << rate->hw_value);
-       }
-
-       IWL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate);
 
        for_each_context(priv, ctx) {
                ctx->staging.cck_basic_rates =
index 2c41423a5e43f195081936533d69f600eeda2818..d8dd9ac7962939081453100fffa4e07321452442 100644 (file)
@@ -861,8 +861,6 @@ struct iwl_priv {
 
        __le16 switch_channel;
 
-       u16 active_rate;
-
        u8 start_calib;
        struct iwl_sensitivity_data sensitivity_data;
        struct iwl_chain_noise_data chain_noise_data;