aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath9k/rc.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c13
-rw-r--r--net/mac80211/mesh_hwmp.c2
-rw-r--r--net/mac80211/rc80211_pid.h2
-rw-r--r--net/mac80211/rc80211_pid_algo.c33
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/mac80211/wext.c4
9 files changed, 32 insertions, 37 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 226d70c73fe6..1cc9daf44550 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -2039,7 +2039,6 @@ static void ath_rate_init(void *priv, void *priv_sta,
2039 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); 2039 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
2040 2040
2041 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 2041 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
2042 sta->txrate_idx = rate_lowest_index(local, sband, sta);
2043 2042
2044 ath_setup_rates(local, sta); 2043 ath_setup_rates(local, sta);
2045 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { 2044 if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index f751b9097592..a279bf1dc9b0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -334,13 +334,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
334 334
335 for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { 335 for (i = IWL_RATE_COUNT - 1; i >= 0; i--) {
336 if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) { 336 if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) {
337 sta->txrate_idx = i; 337 rs_sta->last_txrate_idx = i;
338 break; 338 break;
339 } 339 }
340 } 340 }
341 341
342 rs_sta->last_txrate_idx = sta->txrate_idx;
343
344 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ 342 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */
345 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 343 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
346 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 344 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
@@ -809,15 +807,13 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
809 807
810 rs_sta->last_txrate_idx = index; 808 rs_sta->last_txrate_idx = index;
811 if (sband->band == IEEE80211_BAND_5GHZ) 809 if (sband->band == IEEE80211_BAND_5GHZ)
812 sta->txrate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; 810 sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE;
813 else 811 else
814 sta->txrate_idx = rs_sta->last_txrate_idx; 812 sel->rate_idx = rs_sta->last_txrate_idx;
815 813
816 rcu_read_unlock(); 814 rcu_read_unlock();
817 815
818 IWL_DEBUG_RATE("leave: %d\n", index); 816 IWL_DEBUG_RATE("leave: %d\n", index);
819
820 sel->rate_idx = sta->txrate_idx;
821} 817}
822 818
823static struct rate_control_ops rs_ops = { 819static struct rate_control_ops rs_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index f7191a9a7fb7..a8711c314e6a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2064,14 +2064,6 @@ out:
2064 i = index; 2064 i = index;
2065 lq_sta->last_txrate_idx = i; 2065 lq_sta->last_txrate_idx = i;
2066 2066
2067 /* sta->txrate_idx is an index to A mode rates which start
2068 * at IWL_FIRST_OFDM_RATE
2069 */
2070 if (lq_sta->band == IEEE80211_BAND_5GHZ)
2071 sta->txrate_idx = i - IWL_FIRST_OFDM_RATE;
2072 else
2073 sta->txrate_idx = i;
2074
2075 return; 2067 return;
2076} 2068}
2077 2069
@@ -2234,7 +2226,6 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2234 2226
2235 lq_sta->flush_timer = 0; 2227 lq_sta->flush_timer = 0;
2236 lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; 2228 lq_sta->supp_rates = sta->sta.supp_rates[sband->band];
2237 sta->txrate_idx = 3;
2238 for (j = 0; j < LQ_SIZE; j++) 2229 for (j = 0; j < LQ_SIZE; j++)
2239 for (i = 0; i < IWL_RATE_COUNT; i++) 2230 for (i = 0; i < IWL_RATE_COUNT; i++)
2240 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2231 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
@@ -2269,11 +2260,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2269 } 2260 }
2270 2261
2271 /* Find highest tx rate supported by hardware and destination station */ 2262 /* Find highest tx rate supported by hardware and destination station */
2263 lq_sta->last_txrate_idx = 3;
2272 for (i = 0; i < sband->n_bitrates; i++) 2264 for (i = 0; i < sband->n_bitrates; i++)
2273 if (sta->sta.supp_rates[sband->band] & BIT(i)) 2265 if (sta->sta.supp_rates[sband->band] & BIT(i))
2274 sta->txrate_idx = i; 2266 lq_sta->last_txrate_idx = i;
2275 2267
2276 lq_sta->last_txrate_idx = sta->txrate_idx;
2277 /* For MODE_IEEE80211A, skip over cck rates in global rate table */ 2268 /* For MODE_IEEE80211A, skip over cck rates in global rate table */
2278 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 2269 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
2279 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2270 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 15a5c99270a8..501c7831adb4 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -223,7 +223,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
223 /* bitrate is in units of 100 Kbps, while we need rate in units of 223 /* bitrate is in units of 100 Kbps, while we need rate in units of
224 * 1Mbps. This will be corrected on tx_time computation. 224 * 1Mbps. This will be corrected on tx_time computation.
225 */ 225 */
226 rate = sband->bitrates[sta->txrate_idx].bitrate; 226 rate = sband->bitrates[sta->last_txrate_idx].bitrate;
227 tx_time = (device_constant + 10 * test_frame_len / rate); 227 tx_time = (device_constant + 10 * test_frame_len / rate);
228 estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); 228 estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
229 result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ; 229 result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ;
diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h
index 0a9135b974b5..ffafc5da572e 100644
--- a/net/mac80211/rc80211_pid.h
+++ b/net/mac80211/rc80211_pid.h
@@ -180,6 +180,8 @@ struct rc_pid_sta_info {
180 u32 tx_num_failed; 180 u32 tx_num_failed;
181 u32 tx_num_xmit; 181 u32 tx_num_xmit;
182 182
183 int txrate_idx;
184
183 /* Average failed frames percentage error (i.e. actual vs. target 185 /* Average failed frames percentage error (i.e. actual vs. target
184 * percentage), scaled by RC_PID_SMOOTHING. This value is computed 186 * percentage), scaled by RC_PID_SMOOTHING. This value is computed
185 * using using an exponential weighted average technique: 187 * using using an exponential weighted average technique:
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 24e44f521302..bc1c4569caa1 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -75,7 +75,8 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
75 struct ieee80211_sub_if_data *sdata; 75 struct ieee80211_sub_if_data *sdata;
76 struct ieee80211_supported_band *sband; 76 struct ieee80211_supported_band *sband;
77 int cur_sorted, new_sorted, probe, tmp, n_bitrates, band; 77 int cur_sorted, new_sorted, probe, tmp, n_bitrates, band;
78 int cur = sta->txrate_idx; 78 struct rc_pid_sta_info *spinfo = (void *)sta->rate_ctrl_priv;
79 int cur = spinfo->txrate_idx;
79 80
80 sdata = sta->sdata; 81 sdata = sta->sdata;
81 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 82 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
@@ -111,7 +112,7 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
111 /* Fit the rate found to the nearest supported rate. */ 112 /* Fit the rate found to the nearest supported rate. */
112 do { 113 do {
113 if (rate_supported(sta, band, rinfo[tmp].index)) { 114 if (rate_supported(sta, band, rinfo[tmp].index)) {
114 sta->txrate_idx = rinfo[tmp].index; 115 spinfo->txrate_idx = rinfo[tmp].index;
115 break; 116 break;
116 } 117 }
117 if (adj < 0) 118 if (adj < 0)
@@ -121,9 +122,9 @@ static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
121 } while (tmp < n_bitrates && tmp >= 0); 122 } while (tmp < n_bitrates && tmp >= 0);
122 123
123#ifdef CONFIG_MAC80211_DEBUGFS 124#ifdef CONFIG_MAC80211_DEBUGFS
124 rate_control_pid_event_rate_change( 125 rate_control_pid_event_rate_change(&spinfo->events,
125 &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events, 126 spinfo->txrate_idx,
126 sta->txrate_idx, sband->bitrates[sta->txrate_idx].bitrate); 127 sband->bitrates[spinfo->txrate_idx].bitrate);
127#endif 128#endif
128} 129}
129 130
@@ -190,16 +191,16 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
190 spinfo->tx_num_failed = 0; 191 spinfo->tx_num_failed = 0;
191 192
192 /* If we just switched rate, update the rate behaviour info. */ 193 /* If we just switched rate, update the rate behaviour info. */
193 if (pinfo->oldrate != sta->txrate_idx) { 194 if (pinfo->oldrate != spinfo->txrate_idx) {
194 195
195 i = rinfo[pinfo->oldrate].rev_index; 196 i = rinfo[pinfo->oldrate].rev_index;
196 j = rinfo[sta->txrate_idx].rev_index; 197 j = rinfo[spinfo->txrate_idx].rev_index;
197 198
198 tmp = (pf - spinfo->last_pf); 199 tmp = (pf - spinfo->last_pf);
199 tmp = RC_PID_DO_ARITH_RIGHT_SHIFT(tmp, RC_PID_ARITH_SHIFT); 200 tmp = RC_PID_DO_ARITH_RIGHT_SHIFT(tmp, RC_PID_ARITH_SHIFT);
200 201
201 rinfo[j].diff = rinfo[i].diff + tmp; 202 rinfo[j].diff = rinfo[i].diff + tmp;
202 pinfo->oldrate = sta->txrate_idx; 203 pinfo->oldrate = spinfo->txrate_idx;
203 } 204 }
204 rate_control_pid_normalize(pinfo, sband->n_bitrates); 205 rate_control_pid_normalize(pinfo, sband->n_bitrates);
205 206
@@ -252,19 +253,20 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
252 if (!sta) 253 if (!sta)
253 goto unlock; 254 goto unlock;
254 255
256 spinfo = sta->rate_ctrl_priv;
257
255 /* Don't update the state if we're not controlling the rate. */ 258 /* Don't update the state if we're not controlling the rate. */
256 sdata = sta->sdata; 259 sdata = sta->sdata;
257 if (sdata->force_unicast_rateidx > -1) { 260 if (sdata->force_unicast_rateidx > -1) {
258 sta->txrate_idx = sdata->max_ratectrl_rateidx; 261 spinfo->txrate_idx = sdata->max_ratectrl_rateidx;
259 goto unlock; 262 goto unlock;
260 } 263 }
261 264
262 /* Ignore all frames that were sent with a different rate than the rate 265 /* Ignore all frames that were sent with a different rate than the rate
263 * we currently advise mac80211 to use. */ 266 * we currently advise mac80211 to use. */
264 if (info->tx_rate_idx != sta->txrate_idx) 267 if (info->tx_rate_idx != spinfo->txrate_idx)
265 goto unlock; 268 goto unlock;
266 269
267 spinfo = sta->rate_ctrl_priv;
268 spinfo->tx_num_xmit++; 270 spinfo->tx_num_xmit++;
269 271
270#ifdef CONFIG_MAC80211_DEBUGFS 272#ifdef CONFIG_MAC80211_DEBUGFS
@@ -301,6 +303,7 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
301 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 303 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
302 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 304 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
303 struct ieee80211_sub_if_data *sdata; 305 struct ieee80211_sub_if_data *sdata;
306 struct rc_pid_sta_info *spinfo;
304 struct sta_info *sta; 307 struct sta_info *sta;
305 int rateidx; 308 int rateidx;
306 u16 fc; 309 u16 fc;
@@ -321,10 +324,11 @@ static void rate_control_pid_get_rate(void *priv, struct net_device *dev,
321 324
322 /* If a forced rate is in effect, select it. */ 325 /* If a forced rate is in effect, select it. */
323 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 326 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
327 spinfo = (struct rc_pid_sta_info *)sta->rate_ctrl_priv;
324 if (sdata->force_unicast_rateidx > -1) 328 if (sdata->force_unicast_rateidx > -1)
325 sta->txrate_idx = sdata->force_unicast_rateidx; 329 spinfo->txrate_idx = sdata->force_unicast_rateidx;
326 330
327 rateidx = sta->txrate_idx; 331 rateidx = spinfo->txrate_idx;
328 332
329 if (rateidx >= sband->n_bitrates) 333 if (rateidx >= sband->n_bitrates)
330 rateidx = sband->n_bitrates - 1; 334 rateidx = sband->n_bitrates - 1;
@@ -349,9 +353,10 @@ static void rate_control_pid_rate_init(void *priv, void *priv_sta,
349 * Until that method is implemented, we will use the lowest supported 353 * Until that method is implemented, we will use the lowest supported
350 * rate as a workaround. */ 354 * rate as a workaround. */
351 struct ieee80211_supported_band *sband; 355 struct ieee80211_supported_band *sband;
356 struct rc_pid_sta_info *spinfo = (void *)sta->rate_ctrl_priv;
352 357
353 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 358 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
354 sta->txrate_idx = rate_lowest_index(local, sband, sta); 359 spinfo->txrate_idx = rate_lowest_index(local, sband, sta);
355 sta->fail_avg = 0; 360 sta->fail_avg = 0;
356} 361}
357 362
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 4dafa044b2f2..5d8fabf7a68b 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -274,7 +274,7 @@ struct sta_info {
274 unsigned long tx_packets; 274 unsigned long tx_packets;
275 unsigned long tx_bytes; 275 unsigned long tx_bytes;
276 unsigned long tx_fragments; 276 unsigned long tx_fragments;
277 int txrate_idx; 277 unsigned int last_txrate_idx;
278 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; 278 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
279#ifdef CONFIG_MAC80211_DEBUG_COUNTERS 279#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
280 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; 280 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 07bf228d0b16..7468495d6f9c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -485,6 +485,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
485 485
486 if (likely(tx->rate_idx < 0)) { 486 if (likely(tx->rate_idx < 0)) {
487 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); 487 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel);
488 if (tx->sta)
489 tx->sta->last_txrate_idx = rsel.rate_idx;
488 tx->rate_idx = rsel.rate_idx; 490 tx->rate_idx = rsel.rate_idx;
489 if (unlikely(rsel.probe_idx >= 0)) { 491 if (unlikely(rsel.probe_idx >= 0)) {
490 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; 492 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index aef9707700fd..7e0d53abde24 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -636,8 +636,8 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev,
636 636
637 sta = sta_info_get(local, sdata->u.sta.bssid); 637 sta = sta_info_get(local, sdata->u.sta.bssid);
638 638
639 if (sta && sta->txrate_idx < sband->n_bitrates) 639 if (sta && sta->last_txrate_idx < sband->n_bitrates)
640 rate->value = sband->bitrates[sta->txrate_idx].bitrate; 640 rate->value = sband->bitrates[sta->last_txrate_idx].bitrate;
641 else 641 else
642 rate->value = 0; 642 rate->value = 0;
643 643