aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-10 20:22:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:24 -0400
commitb7e35008815a1c39123f4dd53b430788e2e18da4 (patch)
treea071c5d2c1224eed68a3684b6367155b1eccfebf /drivers
parent95dac040041723d0c0ab245642c1b9802f12cc8d (diff)
mac80211: move last_txrate_idx into RC algorithms
This variable in sta_info is only used in a meaningful way by the Intel RC algorithms, so move it into those. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c15
2 files changed, 21 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index da23c927380f..46b672c34585 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -65,6 +65,9 @@ struct iwl3945_rs_sta {
65 u8 ibss_sta_added; 65 u8 ibss_sta_added;
66 struct timer_list rate_scale_flush; 66 struct timer_list rate_scale_flush;
67 struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; 67 struct iwl3945_rate_scale_data win[IWL_RATE_COUNT];
68
69 /* used to be in sta_info */
70 int last_txrate_idx;
68}; 71};
69 72
70static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { 73static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = {
@@ -319,6 +322,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
319static void rs_rate_init(void *priv_rate, void *priv_sta, 322static void rs_rate_init(void *priv_rate, void *priv_sta,
320 struct ieee80211_local *local, struct sta_info *sta) 323 struct ieee80211_local *local, struct sta_info *sta)
321{ 324{
325 struct iwl3945_rs_sta *rs_sta = (void *)sta->rate_ctrl_priv;
322 int i; 326 int i;
323 327
324 IWL_DEBUG_RATE("enter\n"); 328 IWL_DEBUG_RATE("enter\n");
@@ -335,11 +339,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
335 } 339 }
336 } 340 }
337 341
338 sta->last_txrate_idx = sta->txrate_idx; 342 rs_sta->last_txrate_idx = sta->txrate_idx;
339 343
340 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ 344 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */
341 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 345 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
342 sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 346 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
343 347
344 IWL_DEBUG_RATE("leave\n"); 348 IWL_DEBUG_RATE("leave\n");
345} 349}
@@ -674,14 +678,14 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
674 return; 678 return;
675 } 679 }
676 680
681 rs_sta = (void *)sta->rate_ctrl_priv;
682
677 rate_mask = sta->supp_rates[sband->band]; 683 rate_mask = sta->supp_rates[sband->band];
678 index = min(sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); 684 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
679 685
680 if (sband->band == IEEE80211_BAND_5GHZ) 686 if (sband->band == IEEE80211_BAND_5GHZ)
681 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; 687 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
682 688
683 rs_sta = (void *)sta->rate_ctrl_priv;
684
685 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 689 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
686 !rs_sta->ibss_sta_added) { 690 !rs_sta->ibss_sta_added) {
687 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); 691 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
@@ -803,11 +807,11 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
803 807
804 out: 808 out:
805 809
806 sta->last_txrate_idx = index; 810 rs_sta->last_txrate_idx = index;
807 if (sband->band == IEEE80211_BAND_5GHZ) 811 if (sband->band == IEEE80211_BAND_5GHZ)
808 sta->txrate_idx = sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; 812 sta->txrate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE;
809 else 813 else
810 sta->txrate_idx = sta->last_txrate_idx; 814 sta->txrate_idx = rs_sta->last_txrate_idx;
811 815
812 rcu_read_unlock(); 816 rcu_read_unlock();
813 817
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index af4e0b994e42..54f076bb2022 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
168static void rs_rate_scale_perform(struct iwl_priv *priv, 171static void rs_rate_scale_perform(struct iwl_priv *priv,
@@ -1746,7 +1749,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1746 is_green = lq_sta->is_green; 1749 is_green = lq_sta->is_green;
1747 1750
1748 /* current tx rate */ 1751 /* current tx rate */
1749 index = sta->last_txrate_idx; 1752 index = lq_sta->last_txrate_idx;
1750 1753
1751 IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index, 1754 IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index,
1752 tbl->lq_type); 1755 tbl->lq_type);
@@ -2059,7 +2062,7 @@ lq_update:
2059out: 2062out:
2060 tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green); 2063 tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green);
2061 i = index; 2064 i = index;
2062 sta->last_txrate_idx = i; 2065 lq_sta->last_txrate_idx = i;
2063 2066
2064 /* sta->txrate_idx is an index to A mode rates which start 2067 /* sta->txrate_idx is an index to A mode rates which start
2065 * at IWL_FIRST_OFDM_RATE 2068 * at IWL_FIRST_OFDM_RATE
@@ -2090,7 +2093,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2090 goto out; 2093 goto out;
2091 2094
2092 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2095 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
2093 i = sta->last_txrate_idx; 2096 i = lq_sta->last_txrate_idx;
2094 2097
2095 if ((lq_sta->lq.sta_id == 0xff) && 2098 if ((lq_sta->lq.sta_id == 0xff) &&
2096 (priv->iw_mode == NL80211_IFTYPE_ADHOC)) 2099 (priv->iw_mode == NL80211_IFTYPE_ADHOC))
@@ -2161,7 +2164,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
2161 } 2164 }
2162 2165
2163 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2166 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
2164 i = sta->last_txrate_idx; 2167 i = lq_sta->last_txrate_idx;
2165 2168
2166 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 2169 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
2167 !lq_sta->ibss_sta_added) { 2170 !lq_sta->ibss_sta_added) {
@@ -2270,10 +2273,10 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2270 if (sta->supp_rates[sband->band] & BIT(i)) 2273 if (sta->supp_rates[sband->band] & BIT(i))
2271 sta->txrate_idx = i; 2274 sta->txrate_idx = i;
2272 2275
2273 sta->last_txrate_idx = sta->txrate_idx; 2276 lq_sta->last_txrate_idx = sta->txrate_idx;
2274 /* For MODE_IEEE80211A, skip over cck rates in global rate table */ 2277 /* For MODE_IEEE80211A, skip over cck rates in global rate table */
2275 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 2278 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
2276 sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2279 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
2277 2280
2278 lq_sta->is_dup = 0; 2281 lq_sta->is_dup = 0;
2279 lq_sta->is_green = rs_use_green(priv, conf); 2282 lq_sta->is_green = rs_use_green(priv, conf);