aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-01-27 23:41:38 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:00 -0500
commitfa254a68076bf7ae21747fe2cdb15db306938d78 (patch)
tree689be73cb01da13f7b24cec302eaf9337dd8b1c0 /drivers/net/wireless/iwlwifi
parentc33104f0a782a7746e5d3b975288a4fb3b8293ed (diff)
iwlwifi: 3954 renames iwl3945_rate_scale_priv to iwl3945_rs_sta
This patch renames iwl3945_rate_scale_priv to iwl3945_rs_sta as it better represents the purpose of this variable. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c206
1 files changed, 104 insertions, 102 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index d79f18c41957..80d31ae51e77 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -52,7 +52,7 @@ struct iwl3945_rate_scale_data {
52 unsigned long stamp; 52 unsigned long stamp;
53}; 53};
54 54
55struct iwl3945_rate_scale_priv { 55struct iwl3945_rs_sta {
56 spinlock_t lock; 56 spinlock_t lock;
57 s32 *expected_tpt; 57 s32 *expected_tpt;
58 unsigned long last_partial_flush; 58 unsigned long last_partial_flush;
@@ -181,7 +181,7 @@ static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window)
181 * not flushed. If there were any that were not flushed, then 181 * not flushed. If there were any that were not flushed, then
182 * reschedule the rate flushing routine. 182 * reschedule the rate flushing routine.
183 */ 183 */
184static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_priv) 184static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
185{ 185{
186 int unflushed = 0; 186 int unflushed = 0;
187 int i; 187 int i;
@@ -193,19 +193,19 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_p
193 * since we flushed, clear out the gathered statistics 193 * since we flushed, clear out the gathered statistics
194 */ 194 */
195 for (i = 0; i < IWL_RATE_COUNT; i++) { 195 for (i = 0; i < IWL_RATE_COUNT; i++) {
196 if (!rs_priv->win[i].counter) 196 if (!rs_sta->win[i].counter)
197 continue; 197 continue;
198 198
199 spin_lock_irqsave(&rs_priv->lock, flags); 199 spin_lock_irqsave(&rs_sta->lock, flags);
200 if (time_after(jiffies, rs_priv->win[i].stamp + 200 if (time_after(jiffies, rs_sta->win[i].stamp +
201 IWL_RATE_WIN_FLUSH)) { 201 IWL_RATE_WIN_FLUSH)) {
202 IWL_DEBUG_RATE("flushing %d samples of rate " 202 IWL_DEBUG_RATE("flushing %d samples of rate "
203 "index %d\n", 203 "index %d\n",
204 rs_priv->win[i].counter, i); 204 rs_sta->win[i].counter, i);
205 iwl3945_clear_window(&rs_priv->win[i]); 205 iwl3945_clear_window(&rs_sta->win[i]);
206 } else 206 } else
207 unflushed++; 207 unflushed++;
208 spin_unlock_irqrestore(&rs_priv->lock, flags); 208 spin_unlock_irqrestore(&rs_sta->lock, flags);
209 } 209 }
210 210
211 return unflushed; 211 return unflushed;
@@ -216,28 +216,28 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_p
216 216
217static void iwl3945_bg_rate_scale_flush(unsigned long data) 217static void iwl3945_bg_rate_scale_flush(unsigned long data)
218{ 218{
219 struct iwl3945_rate_scale_priv *rs_priv = (void *)data; 219 struct iwl3945_rs_sta *rs_sta = (void *)data;
220 int unflushed = 0; 220 int unflushed = 0;
221 unsigned long flags; 221 unsigned long flags;
222 u32 packet_count, duration, pps; 222 u32 packet_count, duration, pps;
223 223
224 IWL_DEBUG_RATE("enter\n"); 224 IWL_DEBUG_RATE("enter\n");
225 225
226 unflushed = iwl3945_rate_scale_flush_windows(rs_priv); 226 unflushed = iwl3945_rate_scale_flush_windows(rs_sta);
227 227
228 spin_lock_irqsave(&rs_priv->lock, flags); 228 spin_lock_irqsave(&rs_sta->lock, flags);
229 229
230 rs_priv->flush_pending = 0; 230 rs_sta->flush_pending = 0;
231 231
232 /* Number of packets Rx'd since last time this timer ran */ 232 /* Number of packets Rx'd since last time this timer ran */
233 packet_count = (rs_priv->tx_packets - rs_priv->last_tx_packets) + 1; 233 packet_count = (rs_sta->tx_packets - rs_sta->last_tx_packets) + 1;
234 234
235 rs_priv->last_tx_packets = rs_priv->tx_packets + 1; 235 rs_sta->last_tx_packets = rs_sta->tx_packets + 1;
236 236
237 if (unflushed) { 237 if (unflushed) {
238 duration = 238 duration =
239 jiffies_to_msecs(jiffies - rs_priv->last_partial_flush); 239 jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
240/* duration = jiffies_to_msecs(rs_priv->flush_time); */ 240/* duration = jiffies_to_msecs(rs_sta->flush_time); */
241 241
242 IWL_DEBUG_RATE("Tx'd %d packets in %dms\n", 242 IWL_DEBUG_RATE("Tx'd %d packets in %dms\n",
243 packet_count, duration); 243 packet_count, duration);
@@ -255,23 +255,23 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
255 } else 255 } else
256 duration = IWL_RATE_FLUSH_MAX; 256 duration = IWL_RATE_FLUSH_MAX;
257 257
258 rs_priv->flush_time = msecs_to_jiffies(duration); 258 rs_sta->flush_time = msecs_to_jiffies(duration);
259 259
260 IWL_DEBUG_RATE("new flush period: %d msec ave %d\n", 260 IWL_DEBUG_RATE("new flush period: %d msec ave %d\n",
261 duration, packet_count); 261 duration, packet_count);
262 262
263 mod_timer(&rs_priv->rate_scale_flush, jiffies + 263 mod_timer(&rs_sta->rate_scale_flush, jiffies +
264 rs_priv->flush_time); 264 rs_sta->flush_time);
265 265
266 rs_priv->last_partial_flush = jiffies; 266 rs_sta->last_partial_flush = jiffies;
267 } 267 }
268 268
269 /* If there weren't any unflushed entries, we don't schedule the timer 269 /* If there weren't any unflushed entries, we don't schedule the timer
270 * to run again */ 270 * to run again */
271 271
272 rs_priv->last_flush = jiffies; 272 rs_sta->last_flush = jiffies;
273 273
274 spin_unlock_irqrestore(&rs_priv->lock, flags); 274 spin_unlock_irqrestore(&rs_sta->lock, flags);
275 275
276 IWL_DEBUG_RATE("leave\n"); 276 IWL_DEBUG_RATE("leave\n");
277} 277}
@@ -283,7 +283,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
283 * at this rate. window->data contains the bitmask of successful 283 * at this rate. window->data contains the bitmask of successful
284 * packets. 284 * packets.
285 */ 285 */
286static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv, 286static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
287 struct iwl3945_rate_scale_data *window, 287 struct iwl3945_rate_scale_data *window,
288 int success, int retries) 288 int success, int retries)
289{ 289{
@@ -295,7 +295,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
295 } 295 }
296 296
297 while (retries--) { 297 while (retries--) {
298 spin_lock_irqsave(&rs_priv->lock, flags); 298 spin_lock_irqsave(&rs_sta->lock, flags);
299 299
300 /* If we have filled up the window then subtract one from the 300 /* If we have filled up the window then subtract one from the
301 * success counter if the high-bit is counting toward 301 * success counter if the high-bit is counting toward
@@ -323,7 +323,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
323 /* Tag this window as having been updated */ 323 /* Tag this window as having been updated */
324 window->stamp = jiffies; 324 window->stamp = jiffies;
325 325
326 spin_unlock_irqrestore(&rs_priv->lock, flags); 326 spin_unlock_irqrestore(&rs_sta->lock, flags);
327 } 327 }
328} 328}
329 329
@@ -373,49 +373,49 @@ static void rs_clear(void *priv)
373 373
374static void *rs_alloc_sta(void *priv, gfp_t gfp) 374static void *rs_alloc_sta(void *priv, gfp_t gfp)
375{ 375{
376 struct iwl3945_rate_scale_priv *rs_priv; 376 struct iwl3945_rs_sta *rs_sta;
377 int i; 377 int i;
378 378
379 IWL_DEBUG_RATE("enter\n"); 379 IWL_DEBUG_RATE("enter\n");
380 380
381 rs_priv = kzalloc(sizeof(struct iwl3945_rate_scale_priv), gfp); 381 rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp);
382 if (!rs_priv) { 382 if (!rs_sta) {
383 IWL_DEBUG_RATE("leave: ENOMEM\n"); 383 IWL_DEBUG_RATE("leave: ENOMEM\n");
384 return NULL; 384 return NULL;
385 } 385 }
386 386
387 spin_lock_init(&rs_priv->lock); 387 spin_lock_init(&rs_sta->lock);
388 388
389 rs_priv->start_rate = IWL_RATE_INVALID; 389 rs_sta->start_rate = IWL_RATE_INVALID;
390 390
391 /* default to just 802.11b */ 391 /* default to just 802.11b */
392 rs_priv->expected_tpt = iwl3945_expected_tpt_b; 392 rs_sta->expected_tpt = iwl3945_expected_tpt_b;
393 393
394 rs_priv->last_partial_flush = jiffies; 394 rs_sta->last_partial_flush = jiffies;
395 rs_priv->last_flush = jiffies; 395 rs_sta->last_flush = jiffies;
396 rs_priv->flush_time = IWL_RATE_FLUSH; 396 rs_sta->flush_time = IWL_RATE_FLUSH;
397 rs_priv->last_tx_packets = 0; 397 rs_sta->last_tx_packets = 0;
398 rs_priv->ibss_sta_added = 0; 398 rs_sta->ibss_sta_added = 0;
399 399
400 init_timer(&rs_priv->rate_scale_flush); 400 init_timer(&rs_sta->rate_scale_flush);
401 rs_priv->rate_scale_flush.data = (unsigned long)rs_priv; 401 rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
402 rs_priv->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; 402 rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;
403 403
404 for (i = 0; i < IWL_RATE_COUNT; i++) 404 for (i = 0; i < IWL_RATE_COUNT; i++)
405 iwl3945_clear_window(&rs_priv->win[i]); 405 iwl3945_clear_window(&rs_sta->win[i]);
406 406
407 IWL_DEBUG_RATE("leave\n"); 407 IWL_DEBUG_RATE("leave\n");
408 408
409 return rs_priv; 409 return rs_sta;
410} 410}
411 411
412static void rs_free_sta(void *priv, void *priv_sta) 412static void rs_free_sta(void *priv, void *priv_sta)
413{ 413{
414 struct iwl3945_rate_scale_priv *rs_priv = priv_sta; 414 struct iwl3945_rs_sta *rs_sta = priv_sta;
415 415
416 IWL_DEBUG_RATE("enter\n"); 416 IWL_DEBUG_RATE("enter\n");
417 del_timer_sync(&rs_priv->rate_scale_flush); 417 del_timer_sync(&rs_sta->rate_scale_flush);
418 kfree(rs_priv); 418 kfree(rs_sta);
419 IWL_DEBUG_RATE("leave\n"); 419 IWL_DEBUG_RATE("leave\n");
420} 420}
421 421
@@ -464,7 +464,7 @@ static void rs_tx_status(void *priv_rate,
464 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 464 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
465 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; 465 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
466 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 466 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
467 struct iwl3945_rate_scale_priv *rs_priv; 467 struct iwl3945_rs_sta *rs_sta;
468 468
469 IWL_DEBUG_RATE("enter\n"); 469 IWL_DEBUG_RATE("enter\n");
470 470
@@ -485,9 +485,9 @@ static void rs_tx_status(void *priv_rate,
485 return; 485 return;
486 } 486 }
487 487
488 rs_priv = (void *)sta->rate_ctrl_priv; 488 rs_sta = (void *)sta->rate_ctrl_priv;
489 489
490 rs_priv->tx_packets++; 490 rs_sta->tx_packets++;
491 491
492 scale_rate_index = first_index; 492 scale_rate_index = first_index;
493 last_index = first_index; 493 last_index = first_index;
@@ -514,8 +514,8 @@ static void rs_tx_status(void *priv_rate,
514 514
515 /* Update this rate accounting for as many retries 515 /* Update this rate accounting for as many retries
516 * as was used for it (per current_count) */ 516 * as was used for it (per current_count) */
517 iwl3945_collect_tx_data(rs_priv, 517 iwl3945_collect_tx_data(rs_sta,
518 &rs_priv->win[scale_rate_index], 518 &rs_sta->win[scale_rate_index],
519 0, current_count); 519 0, current_count);
520 IWL_DEBUG_RATE("Update rate %d for %d retries.\n", 520 IWL_DEBUG_RATE("Update rate %d for %d retries.\n",
521 scale_rate_index, current_count); 521 scale_rate_index, current_count);
@@ -533,25 +533,25 @@ static void rs_tx_status(void *priv_rate,
533 last_index, 533 last_index,
534 (tx_resp->flags & IEEE80211_TX_STATUS_ACK) ? 534 (tx_resp->flags & IEEE80211_TX_STATUS_ACK) ?
535 "success" : "failure"); 535 "success" : "failure");
536 iwl3945_collect_tx_data(rs_priv, 536 iwl3945_collect_tx_data(rs_sta,
537 &rs_priv->win[last_index], 537 &rs_sta->win[last_index],
538 tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1); 538 tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1);
539 539
540 /* We updated the rate scale window -- if its been more than 540 /* We updated the rate scale window -- if its been more than
541 * flush_time since the last run, schedule the flush 541 * flush_time since the last run, schedule the flush
542 * again */ 542 * again */
543 spin_lock_irqsave(&rs_priv->lock, flags); 543 spin_lock_irqsave(&rs_sta->lock, flags);
544 544
545 if (!rs_priv->flush_pending && 545 if (!rs_sta->flush_pending &&
546 time_after(jiffies, rs_priv->last_partial_flush + 546 time_after(jiffies, rs_sta->last_partial_flush +
547 rs_priv->flush_time)) { 547 rs_sta->flush_time)) {
548 548
549 rs_priv->flush_pending = 1; 549 rs_sta->flush_pending = 1;
550 mod_timer(&rs_priv->rate_scale_flush, 550 mod_timer(&rs_sta->rate_scale_flush,
551 jiffies + rs_priv->flush_time); 551 jiffies + rs_sta->flush_time);
552 } 552 }
553 553
554 spin_unlock_irqrestore(&rs_priv->lock, flags); 554 spin_unlock_irqrestore(&rs_sta->lock, flags);
555 555
556 sta_info_put(sta); 556 sta_info_put(sta);
557 557
@@ -560,8 +560,8 @@ static void rs_tx_status(void *priv_rate,
560 return; 560 return;
561} 561}
562 562
563static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv, 563static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
564 u8 index, u16 rate_mask, int phymode) 564 u8 index, u16 rate_mask, int phymode)
565{ 565{
566 u8 high = IWL_RATE_INVALID; 566 u8 high = IWL_RATE_INVALID;
567 u8 low = IWL_RATE_INVALID; 567 u8 low = IWL_RATE_INVALID;
@@ -595,7 +595,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
595 595
596 low = index; 596 low = index;
597 while (low != IWL_RATE_INVALID) { 597 while (low != IWL_RATE_INVALID) {
598 if (rs_priv->tgg) 598 if (rs_sta->tgg)
599 low = iwl3945_rates[low].prev_rs_tgg; 599 low = iwl3945_rates[low].prev_rs_tgg;
600 else 600 else
601 low = iwl3945_rates[low].prev_rs; 601 low = iwl3945_rates[low].prev_rs;
@@ -608,7 +608,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
608 608
609 high = index; 609 high = index;
610 while (high != IWL_RATE_INVALID) { 610 while (high != IWL_RATE_INVALID) {
611 if (rs_priv->tgg) 611 if (rs_sta->tgg)
612 high = iwl3945_rates[high].next_rs_tgg; 612 high = iwl3945_rates[high].next_rs_tgg;
613 else 613 else
614 high = iwl3945_rates[high].next_rs; 614 high = iwl3945_rates[high].next_rs;
@@ -646,7 +646,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
646 u8 high = IWL_RATE_INVALID; 646 u8 high = IWL_RATE_INVALID;
647 u16 high_low; 647 u16 high_low;
648 int index; 648 int index;
649 struct iwl3945_rate_scale_priv *rs_priv; 649 struct iwl3945_rs_sta *rs_sta;
650 struct iwl3945_rate_scale_data *window = NULL; 650 struct iwl3945_rate_scale_data *window = NULL;
651 int current_tpt = IWL_INVALID_VALUE; 651 int current_tpt = IWL_INVALID_VALUE;
652 int low_tpt = IWL_INVALID_VALUE; 652 int low_tpt = IWL_INVALID_VALUE;
@@ -684,10 +684,10 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
684 if (priv->phymode == (u8) MODE_IEEE80211A) 684 if (priv->phymode == (u8) MODE_IEEE80211A)
685 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; 685 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
686 686
687 rs_priv = (void *)sta->rate_ctrl_priv; 687 rs_sta = (void *)sta->rate_ctrl_priv;
688 688
689 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && 689 if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
690 !rs_priv->ibss_sta_added) { 690 !rs_sta->ibss_sta_added) {
691 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); 691 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
692 692
693 if (sta_id == IWL_INVALID_STATION) { 693 if (sta_id == IWL_INVALID_STATION) {
@@ -697,24 +697,24 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
697 hdr->addr1, 0, CMD_ASYNC); 697 hdr->addr1, 0, CMD_ASYNC);
698 } 698 }
699 if (sta_id != IWL_INVALID_STATION) 699 if (sta_id != IWL_INVALID_STATION)
700 rs_priv->ibss_sta_added = 1; 700 rs_sta->ibss_sta_added = 1;
701 } 701 }
702 702
703 spin_lock_irqsave(&rs_priv->lock, flags); 703 spin_lock_irqsave(&rs_sta->lock, flags);
704 704
705 if (rs_priv->start_rate != IWL_RATE_INVALID) { 705 if (rs_sta->start_rate != IWL_RATE_INVALID) {
706 index = rs_priv->start_rate; 706 index = rs_sta->start_rate;
707 rs_priv->start_rate = IWL_RATE_INVALID; 707 rs_sta->start_rate = IWL_RATE_INVALID;
708 } 708 }
709 709
710 window = &(rs_priv->win[index]); 710 window = &(rs_sta->win[index]);
711 711
712 fail_count = window->counter - window->success_counter; 712 fail_count = window->counter - window->success_counter;
713 713
714 if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) && 714 if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) &&
715 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { 715 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) {
716 window->average_tpt = IWL_INVALID_VALUE; 716 window->average_tpt = IWL_INVALID_VALUE;
717 spin_unlock_irqrestore(&rs_priv->lock, flags); 717 spin_unlock_irqrestore(&rs_sta->lock, flags);
718 718
719 IWL_DEBUG_RATE("Invalid average_tpt on rate %d: " 719 IWL_DEBUG_RATE("Invalid average_tpt on rate %d: "
720 "counter: %d, success_counter: %d, " 720 "counter: %d, success_counter: %d, "
@@ -722,27 +722,27 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
722 index, 722 index,
723 window->counter, 723 window->counter,
724 window->success_counter, 724 window->success_counter,
725 rs_priv->expected_tpt ? "not " : ""); 725 rs_sta->expected_tpt ? "not " : "");
726 goto out; 726 goto out;
727 727
728 } 728 }
729 729
730 window->average_tpt = ((window->success_ratio * 730 window->average_tpt = ((window->success_ratio *
731 rs_priv->expected_tpt[index] + 64) / 128); 731 rs_sta->expected_tpt[index] + 64) / 128);
732 current_tpt = window->average_tpt; 732 current_tpt = window->average_tpt;
733 733
734 high_low = iwl3945_get_adjacent_rate(rs_priv, index, rate_mask, 734 high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask,
735 local->hw.conf.phymode); 735 local->hw.conf.phymode);
736 low = high_low & 0xff; 736 low = high_low & 0xff;
737 high = (high_low >> 8) & 0xff; 737 high = (high_low >> 8) & 0xff;
738 738
739 if (low != IWL_RATE_INVALID) 739 if (low != IWL_RATE_INVALID)
740 low_tpt = rs_priv->win[low].average_tpt; 740 low_tpt = rs_sta->win[low].average_tpt;
741 741
742 if (high != IWL_RATE_INVALID) 742 if (high != IWL_RATE_INVALID)
743 high_tpt = rs_priv->win[high].average_tpt; 743 high_tpt = rs_sta->win[high].average_tpt;
744 744
745 spin_unlock_irqrestore(&rs_priv->lock, flags); 745 spin_unlock_irqrestore(&rs_sta->lock, flags);
746 746
747 scale_action = 1; 747 scale_action = 1;
748 748
@@ -840,7 +840,7 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
840{ 840{
841 struct ieee80211_local *local = hw_to_local(hw); 841 struct ieee80211_local *local = hw_to_local(hw);
842 struct iwl3945_priv *priv = hw->priv; 842 struct iwl3945_priv *priv = hw->priv;
843 struct iwl3945_rate_scale_priv *rs_priv; 843 struct iwl3945_rs_sta *rs_sta;
844 struct sta_info *sta; 844 struct sta_info *sta;
845 unsigned long flags; 845 unsigned long flags;
846 int count = 0, i; 846 int count = 0, i;
@@ -858,8 +858,8 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
858 return sprintf(buf, "station %d not found\n", sta_id); 858 return sprintf(buf, "station %d not found\n", sta_id);
859 } 859 }
860 860
861 rs_priv = (void *)sta->rate_ctrl_priv; 861 rs_sta = (void *)sta->rate_ctrl_priv;
862 spin_lock_irqsave(&rs_priv->lock, flags); 862 spin_lock_irqsave(&rs_sta->lock, flags);
863 i = IWL_RATE_54M_INDEX; 863 i = IWL_RATE_54M_INDEX;
864 while (1) { 864 while (1) {
865 u64 mask; 865 u64 mask;
@@ -871,15 +871,16 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
871 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); 871 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
872 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) 872 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
873 buf[count++] = 873 buf[count++] =
874 (rs_priv->win[i].data & mask) ? '1' : '0'; 874 (rs_sta->win[i].data & mask) ? '1' : '0';
875 875
876 samples += rs_priv->win[i].counter; 876 samples += rs_sta->win[i].counter;
877 good += rs_priv->win[i].success_counter; 877 good += rs_sta->win[i].success_counter;
878 success += rs_priv->win[i].success_counter * iwl3945_rates[i].ieee; 878 success += rs_sta->win[i].success_counter *
879 iwl3945_rates[i].ieee;
879 880
880 if (rs_priv->win[i].stamp) { 881 if (rs_sta->win[i].stamp) {
881 int delta = 882 int delta =
882 jiffies_to_msecs(now - rs_priv->win[i].stamp); 883 jiffies_to_msecs(now - rs_sta->win[i].stamp);
883 884
884 if (delta > max_time) 885 if (delta > max_time)
885 max_time = delta; 886 max_time = delta;
@@ -893,7 +894,7 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
893 break; 894 break;
894 i = j; 895 i = j;
895 } 896 }
896 spin_unlock_irqrestore(&rs_priv->lock, flags); 897 spin_unlock_irqrestore(&rs_sta->lock, flags);
897 sta_info_put(sta); 898 sta_info_put(sta);
898 899
899 /* Display the average rate of all samples taken. 900 /* Display the average rate of all samples taken.
@@ -919,7 +920,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
919 s32 rssi = 0; 920 s32 rssi = 0;
920 unsigned long flags; 921 unsigned long flags;
921 struct ieee80211_local *local = hw_to_local(hw); 922 struct ieee80211_local *local = hw_to_local(hw);
922 struct iwl3945_rate_scale_priv *rs_priv; 923 struct iwl3945_rs_sta *rs_sta;
923 struct sta_info *sta; 924 struct sta_info *sta;
924 925
925 IWL_DEBUG_RATE("enter\n"); 926 IWL_DEBUG_RATE("enter\n");
@@ -939,33 +940,33 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
939 return; 940 return;
940 } 941 }
941 942
942 rs_priv = (void *)sta->rate_ctrl_priv; 943 rs_sta = (void *)sta->rate_ctrl_priv;
943 944
944 spin_lock_irqsave(&rs_priv->lock, flags); 945 spin_lock_irqsave(&rs_sta->lock, flags);
945 946
946 rs_priv->tgg = 0; 947 rs_sta->tgg = 0;
947 switch (priv->phymode) { 948 switch (priv->phymode) {
948 case MODE_IEEE80211G: 949 case MODE_IEEE80211G:
949 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { 950 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
950 rs_priv->tgg = 1; 951 rs_sta->tgg = 1;
951 rs_priv->expected_tpt = iwl3945_expected_tpt_g_prot; 952 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
952 } else 953 } else
953 rs_priv->expected_tpt = iwl3945_expected_tpt_g; 954 rs_sta->expected_tpt = iwl3945_expected_tpt_g;
954 break; 955 break;
955 956
956 case MODE_IEEE80211A: 957 case MODE_IEEE80211A:
957 rs_priv->expected_tpt = iwl3945_expected_tpt_a; 958 rs_sta->expected_tpt = iwl3945_expected_tpt_a;
958 break; 959 break;
959 960
960 default: 961 default:
961 IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n"); 962 IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n");
962 case MODE_IEEE80211B: 963 case MODE_IEEE80211B:
963 rs_priv->expected_tpt = iwl3945_expected_tpt_b; 964 rs_sta->expected_tpt = iwl3945_expected_tpt_b;
964 break; 965 break;
965 } 966 }
966 967
967 sta_info_put(sta); 968 sta_info_put(sta);
968 spin_unlock_irqrestore(&rs_priv->lock, flags); 969 spin_unlock_irqrestore(&rs_sta->lock, flags);
969 970
970 rssi = priv->last_rx_rssi; 971 rssi = priv->last_rx_rssi;
971 if (rssi == 0) 972 if (rssi == 0)
@@ -973,11 +974,12 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
973 974
974 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); 975 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi);
975 976
976 rs_priv->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->phymode); 977 rs_sta->start_rate =
978 iwl3945_get_rate_index_by_rssi(rssi, priv->phymode);
977 979
978 IWL_DEBUG_RATE("leave: rssi %d assign rate index: " 980 IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
979 "%d (plcp 0x%x)\n", rssi, rs_priv->start_rate, 981 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
980 iwl3945_rates[rs_priv->start_rate].plcp); 982 iwl3945_rates[rs_sta->start_rate].plcp);
981} 983}
982 984
983void iwl3945_rate_control_register(struct ieee80211_hw *hw) 985void iwl3945_rate_control_register(struct ieee80211_hw *hw)