aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c158
1 files changed, 76 insertions, 82 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 80d31ae51e77..85c22641542d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. 3 * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -37,7 +37,7 @@
37 37
38#include <linux/workqueue.h> 38#include <linux/workqueue.h>
39 39
40#include "../net/mac80211/ieee80211_rate.h" 40#include "../net/mac80211/rate.h"
41 41
42#include "iwl-3945.h" 42#include "iwl-3945.h"
43 43
@@ -100,14 +100,6 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_a[] = {
100 {-89, IWL_RATE_6M_INDEX} 100 {-89, IWL_RATE_6M_INDEX}
101}; 101};
102 102
103static struct iwl3945_tpt_entry iwl3945_tpt_table_b[] = {
104 {-86, IWL_RATE_11M_INDEX},
105 {-88, IWL_RATE_5M_INDEX},
106 {-90, IWL_RATE_2M_INDEX},
107 {-92, IWL_RATE_1M_INDEX}
108
109};
110
111static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { 103static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = {
112 {-60, IWL_RATE_54M_INDEX}, 104 {-60, IWL_RATE_54M_INDEX},
113 {-64, IWL_RATE_48M_INDEX}, 105 {-64, IWL_RATE_48M_INDEX},
@@ -129,7 +121,7 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = {
129#define IWL_RATE_MIN_SUCCESS_TH 8 121#define IWL_RATE_MIN_SUCCESS_TH 8
130#define IWL_RATE_DECREASE_TH 1920 122#define IWL_RATE_DECREASE_TH 1920
131 123
132static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode) 124static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
133{ 125{
134 u32 index = 0; 126 u32 index = 0;
135 u32 table_size = 0; 127 u32 table_size = 0;
@@ -138,21 +130,19 @@ static u8 iwl3945_get_rate_index_by_rssi(s32 rssi, u8 mode)
138 if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL)) 130 if ((rssi < IWL_MIN_RSSI_VAL) || (rssi > IWL_MAX_RSSI_VAL))
139 rssi = IWL_MIN_RSSI_VAL; 131 rssi = IWL_MIN_RSSI_VAL;
140 132
141 switch (mode) { 133 switch (band) {
142 case MODE_IEEE80211G: 134 case IEEE80211_BAND_2GHZ:
143 tpt_table = iwl3945_tpt_table_g; 135 tpt_table = iwl3945_tpt_table_g;
144 table_size = ARRAY_SIZE(iwl3945_tpt_table_g); 136 table_size = ARRAY_SIZE(iwl3945_tpt_table_g);
145 break; 137 break;
146 138
147 case MODE_IEEE80211A: 139 case IEEE80211_BAND_5GHZ:
148 tpt_table = iwl3945_tpt_table_a; 140 tpt_table = iwl3945_tpt_table_a;
149 table_size = ARRAY_SIZE(iwl3945_tpt_table_a); 141 table_size = ARRAY_SIZE(iwl3945_tpt_table_a);
150 break; 142 break;
151 143
152 default: 144 default:
153 case MODE_IEEE80211B: 145 BUG();
154 tpt_table = iwl3945_tpt_table_b;
155 table_size = ARRAY_SIZE(iwl3945_tpt_table_b);
156 break; 146 break;
157 } 147 }
158 148
@@ -168,9 +158,9 @@ static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window)
168{ 158{
169 window->data = 0; 159 window->data = 0;
170 window->success_counter = 0; 160 window->success_counter = 0;
171 window->success_ratio = IWL_INVALID_VALUE; 161 window->success_ratio = -1;
172 window->counter = 0; 162 window->counter = 0;
173 window->average_tpt = IWL_INVALID_VALUE; 163 window->average_tpt = IWL_INV_TPT;
174 window->stamp = 0; 164 window->stamp = 0;
175} 165}
176 166
@@ -340,17 +330,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
340 * after assoc.. */ 330 * after assoc.. */
341 331
342 for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { 332 for (i = IWL_RATE_COUNT - 1; i >= 0; i--) {
343 if (sta->supp_rates & (1 << i)) { 333 if (sta->supp_rates[local->hw.conf.channel->band] & (1 << i)) {
344 sta->txrate = i; 334 sta->txrate_idx = i;
345 break; 335 break;
346 } 336 }
347 } 337 }
348 338
349 sta->last_txrate = sta->txrate; 339 sta->last_txrate_idx = sta->txrate_idx;
350 340
351 /* For MODE_IEEE80211A mode it start at IWL_FIRST_OFDM_RATE */ 341 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */
352 if (local->hw.conf.phymode == MODE_IEEE80211A) 342 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ)
353 sta->last_txrate += IWL_FIRST_OFDM_RATE; 343 sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
354 344
355 IWL_DEBUG_RATE("leave\n"); 345 IWL_DEBUG_RATE("leave\n");
356} 346}
@@ -429,17 +419,19 @@ static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
429{ 419{
430 int next_rate = iwl3945_get_prev_ieee_rate(rate); 420 int next_rate = iwl3945_get_prev_ieee_rate(rate);
431 421
432 switch (priv->phymode) { 422 switch (priv->band) {
433 case MODE_IEEE80211A: 423 case IEEE80211_BAND_5GHZ:
434 if (rate == IWL_RATE_12M_INDEX) 424 if (rate == IWL_RATE_12M_INDEX)
435 next_rate = IWL_RATE_9M_INDEX; 425 next_rate = IWL_RATE_9M_INDEX;
436 else if (rate == IWL_RATE_6M_INDEX) 426 else if (rate == IWL_RATE_6M_INDEX)
437 next_rate = IWL_RATE_6M_INDEX; 427 next_rate = IWL_RATE_6M_INDEX;
438 break; 428 break;
429/* XXX cannot be invoked in current mac80211 so not a regression
439 case MODE_IEEE80211B: 430 case MODE_IEEE80211B:
440 if (rate == IWL_RATE_11M_INDEX_TABLE) 431 if (rate == IWL_RATE_11M_INDEX_TABLE)
441 next_rate = IWL_RATE_5M_INDEX_TABLE; 432 next_rate = IWL_RATE_5M_INDEX_TABLE;
442 break; 433 break;
434 */
443 default: 435 default:
444 break; 436 break;
445 } 437 }
@@ -465,22 +457,25 @@ static void rs_tx_status(void *priv_rate,
465 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; 457 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
466 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 458 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
467 struct iwl3945_rs_sta *rs_sta; 459 struct iwl3945_rs_sta *rs_sta;
460 struct ieee80211_supported_band *sband;
468 461
469 IWL_DEBUG_RATE("enter\n"); 462 IWL_DEBUG_RATE("enter\n");
470 463
471 retries = tx_resp->retry_count; 464 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
472 465
473 first_index = tx_resp->control.tx_rate; 466
467 retries = tx_resp->retry_count;
468 first_index = tx_resp->control.tx_rate->hw_value;
474 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { 469 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) {
475 IWL_DEBUG_RATE("leave: Rate out of bounds: %0x for %d\n", 470 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index);
476 tx_resp->control.tx_rate, first_index);
477 return; 471 return;
478 } 472 }
479 473
474 rcu_read_lock();
475
480 sta = sta_info_get(local, hdr->addr1); 476 sta = sta_info_get(local, hdr->addr1);
481 if (!sta || !sta->rate_ctrl_priv) { 477 if (!sta || !sta->rate_ctrl_priv) {
482 if (sta) 478 rcu_read_unlock();
483 sta_info_put(sta);
484 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 479 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
485 return; 480 return;
486 } 481 }
@@ -553,7 +548,7 @@ static void rs_tx_status(void *priv_rate,
553 548
554 spin_unlock_irqrestore(&rs_sta->lock, flags); 549 spin_unlock_irqrestore(&rs_sta->lock, flags);
555 550
556 sta_info_put(sta); 551 rcu_read_unlock();
557 552
558 IWL_DEBUG_RATE("leave\n"); 553 IWL_DEBUG_RATE("leave\n");
559 554
@@ -561,14 +556,14 @@ static void rs_tx_status(void *priv_rate,
561} 556}
562 557
563static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, 558static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
564 u8 index, u16 rate_mask, int phymode) 559 u8 index, u16 rate_mask, enum ieee80211_band band)
565{ 560{
566 u8 high = IWL_RATE_INVALID; 561 u8 high = IWL_RATE_INVALID;
567 u8 low = IWL_RATE_INVALID; 562 u8 low = IWL_RATE_INVALID;
568 563
569 /* 802.11A walks to the next literal adjacent rate in 564 /* 802.11A walks to the next literal adjacent rate in
570 * the rate table */ 565 * the rate table */
571 if (unlikely(phymode == MODE_IEEE80211A)) { 566 if (unlikely(band == IEEE80211_BAND_5GHZ)) {
572 int i; 567 int i;
573 u32 mask; 568 u32 mask;
574 569
@@ -639,7 +634,8 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
639 * 634 *
640 */ 635 */
641static void rs_get_rate(void *priv_rate, struct net_device *dev, 636static void rs_get_rate(void *priv_rate, struct net_device *dev,
642 struct ieee80211_hw_mode *mode, struct sk_buff *skb, 637 struct ieee80211_supported_band *sband,
638 struct sk_buff *skb,
643 struct rate_selection *sel) 639 struct rate_selection *sel)
644{ 640{
645 u8 low = IWL_RATE_INVALID; 641 u8 low = IWL_RATE_INVALID;
@@ -648,9 +644,9 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
648 int index; 644 int index;
649 struct iwl3945_rs_sta *rs_sta; 645 struct iwl3945_rs_sta *rs_sta;
650 struct iwl3945_rate_scale_data *window = NULL; 646 struct iwl3945_rate_scale_data *window = NULL;
651 int current_tpt = IWL_INVALID_VALUE; 647 int current_tpt = IWL_INV_TPT;
652 int low_tpt = IWL_INVALID_VALUE; 648 int low_tpt = IWL_INV_TPT;
653 int high_tpt = IWL_INVALID_VALUE; 649 int high_tpt = IWL_INV_TPT;
654 u32 fail_count; 650 u32 fail_count;
655 s8 scale_action = 0; 651 s8 scale_action = 0;
656 unsigned long flags; 652 unsigned long flags;
@@ -663,6 +659,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
663 659
664 IWL_DEBUG_RATE("enter\n"); 660 IWL_DEBUG_RATE("enter\n");
665 661
662 rcu_read_lock();
663
666 sta = sta_info_get(local, hdr->addr1); 664 sta = sta_info_get(local, hdr->addr1);
667 665
668 /* Send management frames and broadcast/multicast data using lowest 666 /* Send management frames and broadcast/multicast data using lowest
@@ -672,16 +670,15 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
672 is_multicast_ether_addr(hdr->addr1) || 670 is_multicast_ether_addr(hdr->addr1) ||
673 !sta || !sta->rate_ctrl_priv) { 671 !sta || !sta->rate_ctrl_priv) {
674 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 672 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
675 sel->rate = rate_lowest(local, local->oper_hw_mode, sta); 673 sel->rate = rate_lowest(local, sband, sta);
676 if (sta) 674 rcu_read_unlock();
677 sta_info_put(sta);
678 return; 675 return;
679 } 676 }
680 677
681 rate_mask = sta->supp_rates; 678 rate_mask = sta->supp_rates[sband->band];
682 index = min(sta->last_txrate & 0xffff, IWL_RATE_COUNT - 1); 679 index = min(sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
683 680
684 if (priv->phymode == (u8) MODE_IEEE80211A) 681 if (sband->band == IEEE80211_BAND_5GHZ)
685 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; 682 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
686 683
687 rs_sta = (void *)sta->rate_ctrl_priv; 684 rs_sta = (void *)sta->rate_ctrl_priv;
@@ -713,7 +710,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
713 710
714 if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) && 711 if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) &&
715 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { 712 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) {
716 window->average_tpt = IWL_INVALID_VALUE; 713 window->average_tpt = IWL_INV_TPT;
717 spin_unlock_irqrestore(&rs_sta->lock, flags); 714 spin_unlock_irqrestore(&rs_sta->lock, flags);
718 715
719 IWL_DEBUG_RATE("Invalid average_tpt on rate %d: " 716 IWL_DEBUG_RATE("Invalid average_tpt on rate %d: "
@@ -732,7 +729,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
732 current_tpt = window->average_tpt; 729 current_tpt = window->average_tpt;
733 730
734 high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask, 731 high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask,
735 local->hw.conf.phymode); 732 sband->band);
736 low = high_low & 0xff; 733 low = high_low & 0xff;
737 high = (high_low >> 8) & 0xff; 734 high = (high_low >> 8) & 0xff;
738 735
@@ -749,19 +746,16 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
749 if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { 746 if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) {
750 IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); 747 IWL_DEBUG_RATE("decrease rate because of low success_ratio\n");
751 scale_action = -1; 748 scale_action = -1;
752 } else if ((low_tpt == IWL_INVALID_VALUE) && 749 } else if ((low_tpt == IWL_INV_TPT) && (high_tpt == IWL_INV_TPT))
753 (high_tpt == IWL_INVALID_VALUE))
754 scale_action = 1; 750 scale_action = 1;
755 else if ((low_tpt != IWL_INVALID_VALUE) && 751 else if ((low_tpt != IWL_INV_TPT) && (high_tpt != IWL_INV_TPT) &&
756 (high_tpt != IWL_INVALID_VALUE) 752 (low_tpt < current_tpt) && (high_tpt < current_tpt)) {
757 && (low_tpt < current_tpt)
758 && (high_tpt < current_tpt)) {
759 IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < " 753 IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < "
760 "current_tpt [%d]\n", 754 "current_tpt [%d]\n",
761 low_tpt, high_tpt, current_tpt); 755 low_tpt, high_tpt, current_tpt);
762 scale_action = 0; 756 scale_action = 0;
763 } else { 757 } else {
764 if (high_tpt != IWL_INVALID_VALUE) { 758 if (high_tpt != IWL_INV_TPT) {
765 if (high_tpt > current_tpt) 759 if (high_tpt > current_tpt)
766 scale_action = 1; 760 scale_action = 1;
767 else { 761 else {
@@ -769,7 +763,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
769 ("decrease rate because of high tpt\n"); 763 ("decrease rate because of high tpt\n");
770 scale_action = -1; 764 scale_action = -1;
771 } 765 }
772 } else if (low_tpt != IWL_INVALID_VALUE) { 766 } else if (low_tpt != IWL_INV_TPT) {
773 if (low_tpt > current_tpt) { 767 if (low_tpt > current_tpt) {
774 IWL_DEBUG_RATE 768 IWL_DEBUG_RATE
775 ("decrease rate because of low tpt\n"); 769 ("decrease rate because of low tpt\n");
@@ -810,17 +804,17 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
810 804
811 out: 805 out:
812 806
813 sta->last_txrate = index; 807 sta->last_txrate_idx = index;
814 if (priv->phymode == (u8) MODE_IEEE80211A) 808 if (sband->band == IEEE80211_BAND_5GHZ)
815 sta->txrate = sta->last_txrate - IWL_FIRST_OFDM_RATE; 809 sta->txrate_idx = sta->last_txrate_idx - IWL_FIRST_OFDM_RATE;
816 else 810 else
817 sta->txrate = sta->last_txrate; 811 sta->txrate_idx = sta->last_txrate_idx;
818 812
819 sta_info_put(sta); 813 rcu_read_unlock();
820 814
821 IWL_DEBUG_RATE("leave: %d\n", index); 815 IWL_DEBUG_RATE("leave: %d\n", index);
822 816
823 sel->rate = &priv->ieee_rates[index]; 817 sel->rate = &sband->bitrates[sta->txrate_idx];
824} 818}
825 819
826static struct rate_control_ops rs_ops = { 820static struct rate_control_ops rs_ops = {
@@ -848,13 +842,15 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
848 unsigned long now = jiffies; 842 unsigned long now = jiffies;
849 u32 max_time = 0; 843 u32 max_time = 0;
850 844
845 rcu_read_lock();
846
851 sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); 847 sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr);
852 if (!sta || !sta->rate_ctrl_priv) { 848 if (!sta || !sta->rate_ctrl_priv) {
853 if (sta) { 849 if (sta)
854 sta_info_put(sta);
855 IWL_DEBUG_RATE("leave - no private rate data!\n"); 850 IWL_DEBUG_RATE("leave - no private rate data!\n");
856 } else 851 else
857 IWL_DEBUG_RATE("leave - no station!\n"); 852 IWL_DEBUG_RATE("leave - no station!\n");
853 rcu_read_unlock();
858 return sprintf(buf, "station %d not found\n", sta_id); 854 return sprintf(buf, "station %d not found\n", sta_id);
859 } 855 }
860 856
@@ -895,7 +891,7 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
895 i = j; 891 i = j;
896 } 892 }
897 spin_unlock_irqrestore(&rs_sta->lock, flags); 893 spin_unlock_irqrestore(&rs_sta->lock, flags);
898 sta_info_put(sta); 894 rcu_read_unlock();
899 895
900 /* Display the average rate of all samples taken. 896 /* Display the average rate of all samples taken.
901 * 897 *
@@ -932,11 +928,12 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
932 return; 928 return;
933 } 929 }
934 930
931 rcu_read_lock();
932
935 sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); 933 sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr);
936 if (!sta || !sta->rate_ctrl_priv) { 934 if (!sta || !sta->rate_ctrl_priv) {
937 if (sta)
938 sta_info_put(sta);
939 IWL_DEBUG_RATE("leave - no private rate data!\n"); 935 IWL_DEBUG_RATE("leave - no private rate data!\n");
936 rcu_read_unlock();
940 return; 937 return;
941 } 938 }
942 939
@@ -945,8 +942,9 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
945 spin_lock_irqsave(&rs_sta->lock, flags); 942 spin_lock_irqsave(&rs_sta->lock, flags);
946 943
947 rs_sta->tgg = 0; 944 rs_sta->tgg = 0;
948 switch (priv->phymode) { 945 switch (priv->band) {
949 case MODE_IEEE80211G: 946 case IEEE80211_BAND_2GHZ:
947 /* TODO: this always does G, not a regression */
950 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { 948 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
951 rs_sta->tgg = 1; 949 rs_sta->tgg = 1;
952 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; 950 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
@@ -954,18 +952,15 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
954 rs_sta->expected_tpt = iwl3945_expected_tpt_g; 952 rs_sta->expected_tpt = iwl3945_expected_tpt_g;
955 break; 953 break;
956 954
957 case MODE_IEEE80211A: 955 case IEEE80211_BAND_5GHZ:
958 rs_sta->expected_tpt = iwl3945_expected_tpt_a; 956 rs_sta->expected_tpt = iwl3945_expected_tpt_a;
959 break; 957 break;
960 958 case IEEE80211_NUM_BANDS:
961 default: 959 BUG();
962 IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n");
963 case MODE_IEEE80211B:
964 rs_sta->expected_tpt = iwl3945_expected_tpt_b;
965 break; 960 break;
966 } 961 }
967 962
968 sta_info_put(sta); 963 rcu_read_unlock();
969 spin_unlock_irqrestore(&rs_sta->lock, flags); 964 spin_unlock_irqrestore(&rs_sta->lock, flags);
970 965
971 rssi = priv->last_rx_rssi; 966 rssi = priv->last_rx_rssi;
@@ -974,20 +969,19 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
974 969
975 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); 970 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi);
976 971
977 rs_sta->start_rate = 972 rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band);
978 iwl3945_get_rate_index_by_rssi(rssi, priv->phymode);
979 973
980 IWL_DEBUG_RATE("leave: rssi %d assign rate index: " 974 IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
981 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, 975 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
982 iwl3945_rates[rs_sta->start_rate].plcp); 976 iwl3945_rates[rs_sta->start_rate].plcp);
983} 977}
984 978
985void iwl3945_rate_control_register(struct ieee80211_hw *hw) 979int iwl3945_rate_control_register(void)
986{ 980{
987 ieee80211_rate_control_register(&rs_ops); 981 return ieee80211_rate_control_register(&rs_ops);
988} 982}
989 983
990void iwl3945_rate_control_unregister(struct ieee80211_hw *hw) 984void iwl3945_rate_control_unregister(void)
991{ 985{
992 ieee80211_rate_control_unregister(&rs_ops); 986 ieee80211_rate_control_unregister(&rs_ops);
993} 987}