diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 66 |
1 files changed, 27 insertions, 39 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index c293e5b6cbb5..8b57b390c8ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -163,6 +163,9 @@ struct iwl_lq_sta { | |||
163 | u32 dbg_fixed_rate; | 163 | u32 dbg_fixed_rate; |
164 | #endif | 164 | #endif |
165 | struct iwl_priv *drv; | 165 | struct iwl_priv *drv; |
166 | |||
167 | /* used to be in sta_info */ | ||
168 | int last_txrate_idx; | ||
166 | }; | 169 | }; |
167 | 170 | ||
168 | static void rs_rate_scale_perform(struct iwl_priv *priv, | 171 | static void rs_rate_scale_perform(struct iwl_priv *priv, |
@@ -356,18 +359,12 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
356 | struct iwl_lq_sta *lq_data, u8 tid, | 359 | struct iwl_lq_sta *lq_data, u8 tid, |
357 | struct sta_info *sta) | 360 | struct sta_info *sta) |
358 | { | 361 | { |
359 | unsigned long state; | ||
360 | DECLARE_MAC_BUF(mac); | 362 | DECLARE_MAC_BUF(mac); |
361 | 363 | ||
362 | spin_lock_bh(&sta->lock); | 364 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { |
363 | state = sta->ampdu_mlme.tid_state_tx[tid]; | ||
364 | spin_unlock_bh(&sta->lock); | ||
365 | |||
366 | if (state == HT_AGG_STATE_IDLE && | ||
367 | rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { | ||
368 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", | 365 | IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", |
369 | print_mac(mac, sta->addr), tid); | 366 | print_mac(mac, sta->sta.addr), tid); |
370 | ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid); | 367 | ieee80211_start_tx_ba_session(priv->hw, sta->sta.addr, tid); |
371 | } | 368 | } |
372 | } | 369 | } |
373 | 370 | ||
@@ -821,7 +818,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev, | |||
821 | 818 | ||
822 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 819 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
823 | 820 | ||
824 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 821 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
825 | !lq_sta->ibss_sta_added) | 822 | !lq_sta->ibss_sta_added) |
826 | goto out; | 823 | goto out; |
827 | 824 | ||
@@ -1151,10 +1148,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1151 | s8 is_green = lq_sta->is_green; | 1148 | s8 is_green = lq_sta->is_green; |
1152 | 1149 | ||
1153 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1150 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || |
1154 | !sta->ht_info.ht_supported) | 1151 | !sta->sta.ht_info.ht_supported) |
1155 | return -1; | 1152 | return -1; |
1156 | 1153 | ||
1157 | if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) | 1154 | if (((sta->sta.ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) |
1158 | == WLAN_HT_CAP_SM_PS_STATIC) | 1155 | == WLAN_HT_CAP_SM_PS_STATIC) |
1159 | return -1; | 1156 | return -1; |
1160 | 1157 | ||
@@ -1219,7 +1216,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv, | |||
1219 | s32 rate; | 1216 | s32 rate; |
1220 | 1217 | ||
1221 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1218 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || |
1222 | !sta->ht_info.ht_supported) | 1219 | !sta->sta.ht_info.ht_supported) |
1223 | return -1; | 1220 | return -1; |
1224 | 1221 | ||
1225 | IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); | 1222 | IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); |
@@ -1728,7 +1725,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1728 | return; | 1725 | return; |
1729 | 1726 | ||
1730 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 1727 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
1731 | lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; | 1728 | lq_sta->supp_rates = sta->sta.supp_rates[lq_sta->band]; |
1732 | 1729 | ||
1733 | tid = rs_tl_add_packet(lq_sta, hdr); | 1730 | tid = rs_tl_add_packet(lq_sta, hdr); |
1734 | 1731 | ||
@@ -1746,7 +1743,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1746 | is_green = lq_sta->is_green; | 1743 | is_green = lq_sta->is_green; |
1747 | 1744 | ||
1748 | /* current tx rate */ | 1745 | /* current tx rate */ |
1749 | index = sta->last_txrate_idx; | 1746 | index = lq_sta->last_txrate_idx; |
1750 | 1747 | ||
1751 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, | 1748 | IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, |
1752 | tbl->lq_type); | 1749 | tbl->lq_type); |
@@ -2059,15 +2056,7 @@ lq_update: | |||
2059 | out: | 2056 | out: |
2060 | tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); | 2057 | tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); |
2061 | i = index; | 2058 | i = index; |
2062 | sta->last_txrate_idx = i; | 2059 | lq_sta->last_txrate_idx = i; |
2063 | |||
2064 | /* sta->txrate_idx is an index to A mode rates which start | ||
2065 | * at IWL_FIRST_OFDM_RATE | ||
2066 | */ | ||
2067 | if (lq_sta->band == IEEE80211_BAND_5GHZ) | ||
2068 | sta->txrate_idx = i - IWL_FIRST_OFDM_RATE; | ||
2069 | else | ||
2070 | sta->txrate_idx = i; | ||
2071 | 2060 | ||
2072 | return; | 2061 | return; |
2073 | } | 2062 | } |
@@ -2090,10 +2079,10 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2090 | goto out; | 2079 | goto out; |
2091 | 2080 | ||
2092 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 2081 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
2093 | i = sta->last_txrate_idx; | 2082 | i = lq_sta->last_txrate_idx; |
2094 | 2083 | ||
2095 | if ((lq_sta->lq.sta_id == 0xff) && | 2084 | if ((lq_sta->lq.sta_id == 0xff) && |
2096 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 2085 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) |
2097 | goto out; | 2086 | goto out; |
2098 | 2087 | ||
2099 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2088 | valid_tx_ant = priv->hw_params.valid_tx_ant; |
@@ -2161,9 +2150,9 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2161 | } | 2150 | } |
2162 | 2151 | ||
2163 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; | 2152 | lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; |
2164 | i = sta->last_txrate_idx; | 2153 | i = lq_sta->last_txrate_idx; |
2165 | 2154 | ||
2166 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && | 2155 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2167 | !lq_sta->ibss_sta_added) { | 2156 | !lq_sta->ibss_sta_added) { |
2168 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | 2157 | u8 sta_id = iwl_find_station(priv, hdr->addr1); |
2169 | DECLARE_MAC_BUF(mac); | 2158 | DECLARE_MAC_BUF(mac); |
@@ -2230,8 +2219,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2230 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2219 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
2231 | 2220 | ||
2232 | lq_sta->flush_timer = 0; | 2221 | lq_sta->flush_timer = 0; |
2233 | lq_sta->supp_rates = sta->supp_rates[sband->band]; | 2222 | lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; |
2234 | sta->txrate_idx = 3; | ||
2235 | for (j = 0; j < LQ_SIZE; j++) | 2223 | for (j = 0; j < LQ_SIZE; j++) |
2236 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2224 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2237 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); | 2225 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); |
@@ -2243,18 +2231,18 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2243 | * after assoc.. */ | 2231 | * after assoc.. */ |
2244 | 2232 | ||
2245 | lq_sta->ibss_sta_added = 0; | 2233 | lq_sta->ibss_sta_added = 0; |
2246 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2234 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2247 | u8 sta_id = iwl_find_station(priv, sta->addr); | 2235 | u8 sta_id = iwl_find_station(priv, sta->sta.addr); |
2248 | DECLARE_MAC_BUF(mac); | 2236 | DECLARE_MAC_BUF(mac); |
2249 | 2237 | ||
2250 | /* for IBSS the call are from tasklet */ | 2238 | /* for IBSS the call are from tasklet */ |
2251 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2239 | IWL_DEBUG_RATE("LQ: ADD station %s\n", |
2252 | print_mac(mac, sta->addr)); | 2240 | print_mac(mac, sta->sta.addr)); |
2253 | 2241 | ||
2254 | if (sta_id == IWL_INVALID_STATION) { | 2242 | if (sta_id == IWL_INVALID_STATION) { |
2255 | IWL_DEBUG_RATE("LQ: ADD station %s\n", | 2243 | IWL_DEBUG_RATE("LQ: ADD station %s\n", |
2256 | print_mac(mac, sta->addr)); | 2244 | print_mac(mac, sta->sta.addr)); |
2257 | sta_id = iwl_add_station_flags(priv, sta->addr, | 2245 | sta_id = iwl_add_station_flags(priv, sta->sta.addr, |
2258 | 0, CMD_ASYNC, NULL); | 2246 | 0, CMD_ASYNC, NULL); |
2259 | } | 2247 | } |
2260 | if ((sta_id != IWL_INVALID_STATION)) { | 2248 | if ((sta_id != IWL_INVALID_STATION)) { |
@@ -2266,14 +2254,14 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2266 | } | 2254 | } |
2267 | 2255 | ||
2268 | /* Find highest tx rate supported by hardware and destination station */ | 2256 | /* Find highest tx rate supported by hardware and destination station */ |
2257 | lq_sta->last_txrate_idx = 3; | ||
2269 | for (i = 0; i < sband->n_bitrates; i++) | 2258 | for (i = 0; i < sband->n_bitrates; i++) |
2270 | if (sta->supp_rates[sband->band] & BIT(i)) | 2259 | if (sta->sta.supp_rates[sband->band] & BIT(i)) |
2271 | sta->txrate_idx = i; | 2260 | lq_sta->last_txrate_idx = i; |
2272 | 2261 | ||
2273 | sta->last_txrate_idx = sta->txrate_idx; | ||
2274 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ | 2262 | /* For MODE_IEEE80211A, skip over cck rates in global rate table */ |
2275 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | 2263 | if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) |
2276 | sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | 2264 | lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
2277 | 2265 | ||
2278 | lq_sta->is_dup = 0; | 2266 | lq_sta->is_dup = 0; |
2279 | lq_sta->is_green = rs_use_green(priv, conf); | 2267 | lq_sta->is_green = rs_use_green(priv, conf); |