aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-18 12:14:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-24 16:18:03 -0400
commit4b7679a561e552eeda1e3567119bef2bca99b66e (patch)
treeb5f2b45c9186eb954f9329322d07e277e669b422 /drivers/net/wireless/iwlwifi
parent2ff6a6d4e92270283432690adf53a7e5ab186d19 (diff)
mac80211: clean up rate control API
Long awaited, hard work. This patch totally cleans up the rate control API to remove the requirement to include internal headers outside of net/mac80211/. There's one internal use in the PID algorithm left for mesh networking, we'll have to figure out a way to clean that one up and decide how to do the peer link evaluation, possibly independent of the rate control algorithm or via new API. Additionally, ath9k is left using the cross-inclusion hack for now, we will add new API where necessary to make this work properly, but right now I'm not expert enough to do it. It's still off better than before. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c182
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c146
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c11
5 files changed, 104 insertions, 248 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index a279bf1dc9b0..6fc5e7361f26 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -36,8 +36,6 @@
36 36
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38 38
39#include "../net/mac80211/rate.h"
40
41#include "iwl-3945.h" 39#include "iwl-3945.h"
42 40
43#define RS_NAME "iwl-3945-rs" 41#define RS_NAME "iwl-3945-rs"
@@ -319,10 +317,10 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
319 } 317 }
320} 318}
321 319
322static void rs_rate_init(void *priv_rate, void *priv_sta, 320static void rs_rate_init(void *priv, struct ieee80211_supported_band *sband,
323 struct ieee80211_local *local, struct sta_info *sta) 321 struct ieee80211_sta *sta, void *priv_sta)
324{ 322{
325 struct iwl3945_rs_sta *rs_sta = (void *)sta->rate_ctrl_priv; 323 struct iwl3945_rs_sta *rs_sta = priv_sta;
326 int i; 324 int i;
327 325
328 IWL_DEBUG_RATE("enter\n"); 326 IWL_DEBUG_RATE("enter\n");
@@ -333,22 +331,22 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
333 * after assoc.. */ 331 * after assoc.. */
334 332
335 for (i = IWL_RATE_COUNT - 1; i >= 0; i--) { 333 for (i = IWL_RATE_COUNT - 1; i >= 0; i--) {
336 if (sta->sta.supp_rates[local->hw.conf.channel->band] & (1 << i)) { 334 if (sta->supp_rates[sband->band] & (1 << i)) {
337 rs_sta->last_txrate_idx = i; 335 rs_sta->last_txrate_idx = i;
338 break; 336 break;
339 } 337 }
340 } 338 }
341 339
342 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ 340 /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */
343 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 341 if (sband->band == IEEE80211_BAND_5GHZ)
344 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 342 rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
345 343
346 IWL_DEBUG_RATE("leave\n"); 344 IWL_DEBUG_RATE("leave\n");
347} 345}
348 346
349static void *rs_alloc(struct ieee80211_local *local) 347static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
350{ 348{
351 return local->hw.priv; 349 return hw->priv;
352} 350}
353 351
354/* rate scale requires free function to be implemented */ 352/* rate scale requires free function to be implemented */
@@ -356,17 +354,24 @@ static void rs_free(void *priv)
356{ 354{
357 return; 355 return;
358} 356}
357
359static void rs_clear(void *priv) 358static void rs_clear(void *priv)
360{ 359{
361 return; 360 return;
362} 361}
363 362
364 363
365static void *rs_alloc_sta(void *priv, gfp_t gfp) 364static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
366{ 365{
367 struct iwl3945_rs_sta *rs_sta; 366 struct iwl3945_rs_sta *rs_sta;
367 struct iwl3945_sta_priv *psta = (void *) sta->drv_priv;
368 int i; 368 int i;
369 369
370 /*
371 * XXX: If it's using sta->drv_priv anyway, it might
372 * as well just put all the information there.
373 */
374
370 IWL_DEBUG_RATE("enter\n"); 375 IWL_DEBUG_RATE("enter\n");
371 376
372 rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp); 377 rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp);
@@ -375,6 +380,8 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
375 return NULL; 380 return NULL;
376 } 381 }
377 382
383 psta->rs_sta = rs_sta;
384
378 spin_lock_init(&rs_sta->lock); 385 spin_lock_init(&rs_sta->lock);
379 386
380 rs_sta->start_rate = IWL_RATE_INVALID; 387 rs_sta->start_rate = IWL_RATE_INVALID;
@@ -400,10 +407,14 @@ static void *rs_alloc_sta(void *priv, gfp_t gfp)
400 return rs_sta; 407 return rs_sta;
401} 408}
402 409
403static void rs_free_sta(void *priv, void *priv_sta) 410static void rs_free_sta(void *priv, struct ieee80211_sta *sta,
411 void *priv_sta)
404{ 412{
413 struct iwl3945_sta_priv *psta = (void *) sta->drv_priv;
405 struct iwl3945_rs_sta *rs_sta = priv_sta; 414 struct iwl3945_rs_sta *rs_sta = priv_sta;
406 415
416 psta->rs_sta = NULL;
417
407 IWL_DEBUG_RATE("enter\n"); 418 IWL_DEBUG_RATE("enter\n");
408 del_timer_sync(&rs_sta->rate_scale_flush); 419 del_timer_sync(&rs_sta->rate_scale_flush);
409 kfree(rs_sta); 420 kfree(rs_sta);
@@ -445,26 +456,19 @@ static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
445 * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by 456 * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by
446 * the hardware for each rate. 457 * the hardware for each rate.
447 */ 458 */
448static void rs_tx_status(void *priv_rate, 459static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband,
449 struct net_device *dev, 460 struct ieee80211_sta *sta, void *priv_sta,
450 struct sk_buff *skb) 461 struct sk_buff *skb)
451{ 462{
452 u8 retries, current_count; 463 u8 retries, current_count;
453 int scale_rate_index, first_index, last_index; 464 int scale_rate_index, first_index, last_index;
454 unsigned long flags; 465 unsigned long flags;
455 struct sta_info *sta;
456 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
457 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; 466 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
458 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 467 struct iwl3945_rs_sta *rs_sta = priv_sta;
459 struct iwl3945_rs_sta *rs_sta;
460 struct ieee80211_supported_band *sband;
461 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 468 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
462 469
463 IWL_DEBUG_RATE("enter\n"); 470 IWL_DEBUG_RATE("enter\n");
464 471
465 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
466
467
468 retries = info->status.retry_count; 472 retries = info->status.retry_count;
469 first_index = sband->bitrates[info->tx_rate_idx].hw_value; 473 first_index = sband->bitrates[info->tx_rate_idx].hw_value;
470 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { 474 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) {
@@ -472,17 +476,11 @@ static void rs_tx_status(void *priv_rate,
472 return; 476 return;
473 } 477 }
474 478
475 rcu_read_lock(); 479 if (!priv_sta) {
476
477 sta = sta_info_get(local, hdr->addr1);
478 if (!sta || !sta->rate_ctrl_priv) {
479 rcu_read_unlock();
480 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 480 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
481 return; 481 return;
482 } 482 }
483 483
484 rs_sta = (void *)sta->rate_ctrl_priv;
485
486 rs_sta->tx_packets++; 484 rs_sta->tx_packets++;
487 485
488 scale_rate_index = first_index; 486 scale_rate_index = first_index;
@@ -549,8 +547,6 @@ static void rs_tx_status(void *priv_rate,
549 547
550 spin_unlock_irqrestore(&rs_sta->lock, flags); 548 spin_unlock_irqrestore(&rs_sta->lock, flags);
551 549
552 rcu_read_unlock();
553
554 IWL_DEBUG_RATE("leave\n"); 550 IWL_DEBUG_RATE("leave\n");
555 551
556 return; 552 return;
@@ -634,16 +630,15 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
634 * rate table and must reference the driver allocated rate table 630 * rate table and must reference the driver allocated rate table
635 * 631 *
636 */ 632 */
637static void rs_get_rate(void *priv_rate, struct net_device *dev, 633static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
638 struct ieee80211_supported_band *sband, 634 struct ieee80211_sta *sta, void *priv_sta,
639 struct sk_buff *skb, 635 struct sk_buff *skb, struct rate_selection *sel)
640 struct rate_selection *sel)
641{ 636{
642 u8 low = IWL_RATE_INVALID; 637 u8 low = IWL_RATE_INVALID;
643 u8 high = IWL_RATE_INVALID; 638 u8 high = IWL_RATE_INVALID;
644 u16 high_low; 639 u16 high_low;
645 int index; 640 int index;
646 struct iwl3945_rs_sta *rs_sta; 641 struct iwl3945_rs_sta *rs_sta = priv_sta;
647 struct iwl3945_rate_scale_data *window = NULL; 642 struct iwl3945_rate_scale_data *window = NULL;
648 int current_tpt = IWL_INV_TPT; 643 int current_tpt = IWL_INV_TPT;
649 int low_tpt = IWL_INV_TPT; 644 int low_tpt = IWL_INV_TPT;
@@ -651,34 +646,25 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
651 u32 fail_count; 646 u32 fail_count;
652 s8 scale_action = 0; 647 s8 scale_action = 0;
653 unsigned long flags; 648 unsigned long flags;
654 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
655 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 649 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
656 struct sta_info *sta;
657 u16 fc, rate_mask; 650 u16 fc, rate_mask;
658 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; 651 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r;
659 DECLARE_MAC_BUF(mac); 652 DECLARE_MAC_BUF(mac);
660 653
661 IWL_DEBUG_RATE("enter\n"); 654 IWL_DEBUG_RATE("enter\n");
662 655
663 rcu_read_lock();
664
665 sta = sta_info_get(local, hdr->addr1);
666
667 /* Send management frames and broadcast/multicast data using lowest 656 /* Send management frames and broadcast/multicast data using lowest
668 * rate. */ 657 * rate. */
669 fc = le16_to_cpu(hdr->frame_control); 658 fc = le16_to_cpu(hdr->frame_control);
670 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || 659 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
671 is_multicast_ether_addr(hdr->addr1) || 660 is_multicast_ether_addr(hdr->addr1) ||
672 !sta || !sta->rate_ctrl_priv) { 661 !sta || !priv_sta) {
673 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 662 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
674 sel->rate_idx = rate_lowest_index(local, sband, sta); 663 sel->rate_idx = rate_lowest_index(sband, sta);
675 rcu_read_unlock();
676 return; 664 return;
677 } 665 }
678 666
679 rs_sta = (void *)sta->rate_ctrl_priv; 667 rate_mask = sta->supp_rates[sband->band];
680
681 rate_mask = sta->sta.supp_rates[sband->band];
682 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); 668 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
683 669
684 if (sband->band == IEEE80211_BAND_5GHZ) 670 if (sband->band == IEEE80211_BAND_5GHZ)
@@ -811,8 +797,6 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
811 else 797 else
812 sel->rate_idx = rs_sta->last_txrate_idx; 798 sel->rate_idx = rs_sta->last_txrate_idx;
813 799
814 rcu_read_unlock();
815
816 IWL_DEBUG_RATE("leave: %d\n", index); 800 IWL_DEBUG_RATE("leave: %d\n", index);
817} 801}
818 802
@@ -829,114 +813,28 @@ static struct rate_control_ops rs_ops = {
829 .free_sta = rs_free_sta, 813 .free_sta = rs_free_sta,
830}; 814};
831 815
832int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
833{
834 struct ieee80211_local *local = hw_to_local(hw);
835 struct iwl3945_priv *priv = hw->priv;
836 struct iwl3945_rs_sta *rs_sta;
837 struct sta_info *sta;
838 unsigned long flags;
839 int count = 0, i;
840 u32 samples = 0, success = 0, good = 0;
841 unsigned long now = jiffies;
842 u32 max_time = 0;
843
844 rcu_read_lock();
845
846 sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr);
847 if (!sta || !sta->rate_ctrl_priv) {
848 if (sta)
849 IWL_DEBUG_RATE("leave - no private rate data!\n");
850 else
851 IWL_DEBUG_RATE("leave - no station!\n");
852 rcu_read_unlock();
853 return sprintf(buf, "station %d not found\n", sta_id);
854 }
855
856 rs_sta = (void *)sta->rate_ctrl_priv;
857 spin_lock_irqsave(&rs_sta->lock, flags);
858 i = IWL_RATE_54M_INDEX;
859 while (1) {
860 u64 mask;
861 int j;
862
863 count +=
864 sprintf(&buf[count], " %2dMbs: ", iwl3945_rates[i].ieee / 2);
865
866 mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
867 for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
868 buf[count++] =
869 (rs_sta->win[i].data & mask) ? '1' : '0';
870
871 samples += rs_sta->win[i].counter;
872 good += rs_sta->win[i].success_counter;
873 success += rs_sta->win[i].success_counter *
874 iwl3945_rates[i].ieee;
875
876 if (rs_sta->win[i].stamp) {
877 int delta =
878 jiffies_to_msecs(now - rs_sta->win[i].stamp);
879
880 if (delta > max_time)
881 max_time = delta;
882
883 count += sprintf(&buf[count], "%5dms\n", delta);
884 } else
885 buf[count++] = '\n';
886
887 j = iwl3945_get_prev_ieee_rate(i);
888 if (j == i)
889 break;
890 i = j;
891 }
892 spin_unlock_irqrestore(&rs_sta->lock, flags);
893 rcu_read_unlock();
894
895 /* Display the average rate of all samples taken.
896 *
897 * NOTE: We multiple # of samples by 2 since the IEEE measurement
898 * added from iwl3945_rates is actually 2X the rate */
899 if (samples)
900 count += sprintf(
901 &buf[count],
902 "\nAverage rate is %3d.%02dMbs over last %4dms\n"
903 "%3d%% success (%d good packets over %d tries)\n",
904 success / (2 * samples), (success * 5 / samples) % 10,
905 max_time, good * 100 / samples, good, samples);
906 else
907 count += sprintf(&buf[count], "\nAverage rate: 0Mbs\n");
908
909 return count;
910}
911
912void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) 816void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
913{ 817{
914 struct iwl3945_priv *priv = hw->priv; 818 struct iwl3945_priv *priv = hw->priv;
915 s32 rssi = 0; 819 s32 rssi = 0;
916 unsigned long flags; 820 unsigned long flags;
917 struct ieee80211_local *local = hw_to_local(hw);
918 struct iwl3945_rs_sta *rs_sta; 821 struct iwl3945_rs_sta *rs_sta;
919 struct sta_info *sta; 822 struct ieee80211_sta *sta;
823 struct iwl3945_sta_priv *psta;
920 824
921 IWL_DEBUG_RATE("enter\n"); 825 IWL_DEBUG_RATE("enter\n");
922 826
923 if (!local->rate_ctrl->ops->name ||
924 strcmp(local->rate_ctrl->ops->name, RS_NAME)) {
925 IWL_WARNING("iwl-3945-rs not selected as rate control algo!\n");
926 IWL_DEBUG_RATE("leave - mac80211 picked the wrong RC algo.\n");
927 return;
928 }
929
930 rcu_read_lock(); 827 rcu_read_lock();
931 828
932 sta = sta_info_get(local, priv->stations[sta_id].sta.sta.addr); 829 sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr);
933 if (!sta || !sta->rate_ctrl_priv) { 830 psta = (void *) sta->drv_priv;
831 if (!sta || !psta) {
934 IWL_DEBUG_RATE("leave - no private rate data!\n"); 832 IWL_DEBUG_RATE("leave - no private rate data!\n");
935 rcu_read_unlock(); 833 rcu_read_unlock();
936 return; 834 return;
937 } 835 }
938 836
939 rs_sta = (void *)sta->rate_ctrl_priv; 837 rs_sta = psta->rs_sta;
940 838
941 spin_lock_irqsave(&rs_sta->lock, flags); 839 spin_lock_irqsave(&rs_sta->lock, flags);
942 840
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
index f085d330bdcf..98b17ae6ef24 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
@@ -176,15 +176,6 @@ static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index)
176} 176}
177 177
178/** 178/**
179 * iwl3945_fill_rs_info - Fill an output text buffer with the rate representation
180 *
181 * NOTE: This is provided as a quick mechanism for a user to visualize
182 * the performance of the rate control algorithm and is not meant to be
183 * parsed software.
184 */
185extern int iwl3945_fill_rs_info(struct ieee80211_hw *, char *buf, u8 sta_id);
186
187/**
188 * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info 179 * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info
189 * 180 *
190 * The specific throughput table used is based on the type of network 181 * The specific throughput table used is based on the type of network
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 2a4933b5fb64..bdd32475b99c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -73,6 +73,10 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
73extern int iwl3945_param_hwcrypto; 73extern int iwl3945_param_hwcrypto;
74extern int iwl3945_param_queues_num; 74extern int iwl3945_param_queues_num;
75 75
76struct iwl3945_sta_priv {
77 struct iwl3945_rs_sta *rs_sta;
78};
79
76enum iwl3945_antenna { 80enum iwl3945_antenna {
77 IWL_ANTENNA_DIVERSITY, 81 IWL_ANTENNA_DIVERSITY,
78 IWL_ANTENNA_MAIN, 82 IWL_ANTENNA_MAIN,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 8b57b390c8ba..93944de923ca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -35,8 +35,6 @@
35 35
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37 37
38#include "../net/mac80211/rate.h"
39
40#include "iwl-dev.h" 38#include "iwl-dev.h"
41#include "iwl-sta.h" 39#include "iwl-sta.h"
42#include "iwl-core.h" 40#include "iwl-core.h"
@@ -169,9 +167,9 @@ struct iwl_lq_sta {
169}; 167};
170 168
171static void rs_rate_scale_perform(struct iwl_priv *priv, 169static void rs_rate_scale_perform(struct iwl_priv *priv,
172 struct net_device *dev,
173 struct ieee80211_hdr *hdr, 170 struct ieee80211_hdr *hdr,
174 struct sta_info *sta); 171 struct ieee80211_sta *sta,
172 struct iwl_lq_sta *lq_sta);
175static void rs_fill_link_cmd(const struct iwl_priv *priv, 173static void rs_fill_link_cmd(const struct iwl_priv *priv,
176 struct iwl_lq_sta *lq_sta, u32 rate_n_flags); 174 struct iwl_lq_sta *lq_sta, u32 rate_n_flags);
177 175
@@ -357,20 +355,20 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid)
357 355
358static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, 356static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
359 struct iwl_lq_sta *lq_data, u8 tid, 357 struct iwl_lq_sta *lq_data, u8 tid,
360 struct sta_info *sta) 358 struct ieee80211_sta *sta)
361{ 359{
362 DECLARE_MAC_BUF(mac); 360 DECLARE_MAC_BUF(mac);
363 361
364 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { 362 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
365 IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n", 363 IWL_DEBUG_HT("Starting Tx agg: STA: %s tid: %d\n",
366 print_mac(mac, sta->sta.addr), tid); 364 print_mac(mac, sta->addr), tid);
367 ieee80211_start_tx_ba_session(priv->hw, sta->sta.addr, tid); 365 ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid);
368 } 366 }
369} 367}
370 368
371static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, 369static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
372 struct iwl_lq_sta *lq_data, 370 struct iwl_lq_sta *lq_data,
373 struct sta_info *sta) 371 struct ieee80211_sta *sta)
374{ 372{
375 if ((tid < TID_MAX_LOAD_COUNT)) 373 if ((tid < TID_MAX_LOAD_COUNT))
376 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); 374 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta);
@@ -770,7 +768,8 @@ out:
770/* 768/*
771 * mac80211 sends us Tx status 769 * mac80211 sends us Tx status
772 */ 770 */
773static void rs_tx_status(void *priv_rate, struct net_device *dev, 771static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
772 struct ieee80211_sta *sta, void *priv_sta,
774 struct sk_buff *skb) 773 struct sk_buff *skb)
775{ 774{
776 int status; 775 int status;
@@ -778,11 +777,9 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
778 int rs_index, index = 0; 777 int rs_index, index = 0;
779 struct iwl_lq_sta *lq_sta; 778 struct iwl_lq_sta *lq_sta;
780 struct iwl_link_quality_cmd *table; 779 struct iwl_link_quality_cmd *table;
781 struct sta_info *sta;
782 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 780 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
783 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 781 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
784 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 782 struct ieee80211_hw *hw = priv->hw;
785 struct ieee80211_hw *hw = local_to_hw(local);
786 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 783 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
787 struct iwl_rate_scale_data *window = NULL; 784 struct iwl_rate_scale_data *window = NULL;
788 struct iwl_rate_scale_data *search_win = NULL; 785 struct iwl_rate_scale_data *search_win = NULL;
@@ -808,15 +805,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
808 if (retries > 15) 805 if (retries > 15)
809 retries = 15; 806 retries = 15;
810 807
811 rcu_read_lock(); 808 lq_sta = (struct iwl_lq_sta *)priv_sta;
812
813 sta = sta_info_get(local, hdr->addr1);
814
815 if (!sta || !sta->rate_ctrl_priv)
816 goto out;
817
818
819 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
820 809
821 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 810 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
822 !lq_sta->ibss_sta_added) 811 !lq_sta->ibss_sta_added)
@@ -962,9 +951,8 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
962 } 951 }
963 952
964 /* See if there's a better rate or modulation mode to try. */ 953 /* See if there's a better rate or modulation mode to try. */
965 rs_rate_scale_perform(priv, dev, hdr, sta); 954 rs_rate_scale_perform(priv, hdr, sta, lq_sta);
966out: 955out:
967 rcu_read_unlock();
968 return; 956 return;
969} 957}
970 958
@@ -1140,7 +1128,7 @@ static s32 rs_get_best_rate(struct iwl_priv *priv,
1140static int rs_switch_to_mimo2(struct iwl_priv *priv, 1128static int rs_switch_to_mimo2(struct iwl_priv *priv,
1141 struct iwl_lq_sta *lq_sta, 1129 struct iwl_lq_sta *lq_sta,
1142 struct ieee80211_conf *conf, 1130 struct ieee80211_conf *conf,
1143 struct sta_info *sta, 1131 struct ieee80211_sta *sta,
1144 struct iwl_scale_tbl_info *tbl, int index) 1132 struct iwl_scale_tbl_info *tbl, int index)
1145{ 1133{
1146 u16 rate_mask; 1134 u16 rate_mask;
@@ -1148,10 +1136,10 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1148 s8 is_green = lq_sta->is_green; 1136 s8 is_green = lq_sta->is_green;
1149 1137
1150 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || 1138 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
1151 !sta->sta.ht_info.ht_supported) 1139 !sta->ht_info.ht_supported)
1152 return -1; 1140 return -1;
1153 1141
1154 if (((sta->sta.ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2) 1142 if (((sta->ht_info.cap & IEEE80211_HT_CAP_SM_PS) >> 2)
1155 == WLAN_HT_CAP_SM_PS_STATIC) 1143 == WLAN_HT_CAP_SM_PS_STATIC)
1156 return -1; 1144 return -1;
1157 1145
@@ -1208,7 +1196,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1208static int rs_switch_to_siso(struct iwl_priv *priv, 1196static int rs_switch_to_siso(struct iwl_priv *priv,
1209 struct iwl_lq_sta *lq_sta, 1197 struct iwl_lq_sta *lq_sta,
1210 struct ieee80211_conf *conf, 1198 struct ieee80211_conf *conf,
1211 struct sta_info *sta, 1199 struct ieee80211_sta *sta,
1212 struct iwl_scale_tbl_info *tbl, int index) 1200 struct iwl_scale_tbl_info *tbl, int index)
1213{ 1201{
1214 u16 rate_mask; 1202 u16 rate_mask;
@@ -1216,7 +1204,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1216 s32 rate; 1204 s32 rate;
1217 1205
1218 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || 1206 if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
1219 !sta->sta.ht_info.ht_supported) 1207 !sta->ht_info.ht_supported)
1220 return -1; 1208 return -1;
1221 1209
1222 IWL_DEBUG_RATE("LQ: try to switch to SISO\n"); 1210 IWL_DEBUG_RATE("LQ: try to switch to SISO\n");
@@ -1268,7 +1256,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
1268static int rs_move_legacy_other(struct iwl_priv *priv, 1256static int rs_move_legacy_other(struct iwl_priv *priv,
1269 struct iwl_lq_sta *lq_sta, 1257 struct iwl_lq_sta *lq_sta,
1270 struct ieee80211_conf *conf, 1258 struct ieee80211_conf *conf,
1271 struct sta_info *sta, 1259 struct ieee80211_sta *sta,
1272 int index) 1260 int index)
1273{ 1261{
1274 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1262 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
@@ -1376,7 +1364,7 @@ out:
1376static int rs_move_siso_to_other(struct iwl_priv *priv, 1364static int rs_move_siso_to_other(struct iwl_priv *priv,
1377 struct iwl_lq_sta *lq_sta, 1365 struct iwl_lq_sta *lq_sta,
1378 struct ieee80211_conf *conf, 1366 struct ieee80211_conf *conf,
1379 struct sta_info *sta, int index) 1367 struct ieee80211_sta *sta, int index)
1380{ 1368{
1381 u8 is_green = lq_sta->is_green; 1369 u8 is_green = lq_sta->is_green;
1382 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1370 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
@@ -1487,7 +1475,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1487static int rs_move_mimo_to_other(struct iwl_priv *priv, 1475static int rs_move_mimo_to_other(struct iwl_priv *priv,
1488 struct iwl_lq_sta *lq_sta, 1476 struct iwl_lq_sta *lq_sta,
1489 struct ieee80211_conf *conf, 1477 struct ieee80211_conf *conf,
1490 struct sta_info *sta, int index) 1478 struct ieee80211_sta *sta, int index)
1491{ 1479{
1492 s8 is_green = lq_sta->is_green; 1480 s8 is_green = lq_sta->is_green;
1493 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1481 struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
@@ -1680,12 +1668,11 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta)
1680 * Do rate scaling and search for new modulation mode. 1668 * Do rate scaling and search for new modulation mode.
1681 */ 1669 */
1682static void rs_rate_scale_perform(struct iwl_priv *priv, 1670static void rs_rate_scale_perform(struct iwl_priv *priv,
1683 struct net_device *dev,
1684 struct ieee80211_hdr *hdr, 1671 struct ieee80211_hdr *hdr,
1685 struct sta_info *sta) 1672 struct ieee80211_sta *sta,
1673 struct iwl_lq_sta *lq_sta)
1686{ 1674{
1687 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1675 struct ieee80211_hw *hw = priv->hw;
1688 struct ieee80211_hw *hw = local_to_hw(local);
1689 struct ieee80211_conf *conf = &hw->conf; 1676 struct ieee80211_conf *conf = &hw->conf;
1690 int low = IWL_RATE_INVALID; 1677 int low = IWL_RATE_INVALID;
1691 int high = IWL_RATE_INVALID; 1678 int high = IWL_RATE_INVALID;
@@ -1700,7 +1687,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1700 __le16 fc; 1687 __le16 fc;
1701 u16 rate_mask; 1688 u16 rate_mask;
1702 u8 update_lq = 0; 1689 u8 update_lq = 0;
1703 struct iwl_lq_sta *lq_sta;
1704 struct iwl_scale_tbl_info *tbl, *tbl1; 1690 struct iwl_scale_tbl_info *tbl, *tbl1;
1705 u16 rate_scale_index_msk = 0; 1691 u16 rate_scale_index_msk = 0;
1706 u32 rate; 1692 u32 rate;
@@ -1721,11 +1707,10 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1721 return; 1707 return;
1722 } 1708 }
1723 1709
1724 if (!sta || !sta->rate_ctrl_priv) 1710 if (!sta || !lq_sta)
1725 return; 1711 return;
1726 1712
1727 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 1713 lq_sta->supp_rates = sta->supp_rates[lq_sta->band];
1728 lq_sta->supp_rates = sta->sta.supp_rates[lq_sta->band];
1729 1714
1730 tid = rs_tl_add_packet(lq_sta, hdr); 1715 tid = rs_tl_add_packet(lq_sta, hdr);
1731 1716
@@ -2064,9 +2049,9 @@ out:
2064 2049
2065static void rs_initialize_lq(struct iwl_priv *priv, 2050static void rs_initialize_lq(struct iwl_priv *priv,
2066 struct ieee80211_conf *conf, 2051 struct ieee80211_conf *conf,
2067 struct sta_info *sta) 2052 struct ieee80211_sta *sta,
2053 struct iwl_lq_sta *lq_sta)
2068{ 2054{
2069 struct iwl_lq_sta *lq_sta;
2070 struct iwl_scale_tbl_info *tbl; 2055 struct iwl_scale_tbl_info *tbl;
2071 int rate_idx; 2056 int rate_idx;
2072 int i; 2057 int i;
@@ -2075,10 +2060,9 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2075 u8 active_tbl = 0; 2060 u8 active_tbl = 0;
2076 u8 valid_tx_ant; 2061 u8 valid_tx_ant;
2077 2062
2078 if (!sta || !sta->rate_ctrl_priv) 2063 if (!sta || !lq_sta)
2079 goto out; 2064 goto out;
2080 2065
2081 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv;
2082 i = lq_sta->last_txrate_idx; 2066 i = lq_sta->last_txrate_idx;
2083 2067
2084 if ((lq_sta->lq.sta_id == 0xff) && 2068 if ((lq_sta->lq.sta_id == 0xff) &&
@@ -2119,37 +2103,30 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2119 return; 2103 return;
2120} 2104}
2121 2105
2122static void rs_get_rate(void *priv_rate, struct net_device *dev, 2106static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2123 struct ieee80211_supported_band *sband, 2107 struct ieee80211_sta *sta, void *priv_sta,
2124 struct sk_buff *skb, 2108 struct sk_buff *skb, struct rate_selection *sel)
2125 struct rate_selection *sel)
2126{ 2109{
2127 2110
2128 int i; 2111 int i;
2129 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2112 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2130 struct ieee80211_conf *conf = &local->hw.conf; 2113 struct ieee80211_conf *conf = &priv->hw->conf;
2131 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2114 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2132 struct sta_info *sta;
2133 __le16 fc; 2115 __le16 fc;
2134 struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
2135 struct iwl_lq_sta *lq_sta; 2116 struct iwl_lq_sta *lq_sta;
2136 2117
2137 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); 2118 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
2138 2119
2139 rcu_read_lock();
2140
2141 sta = sta_info_get(local, hdr->addr1);
2142
2143 /* Send management frames and broadcast/multicast data using lowest 2120 /* Send management frames and broadcast/multicast data using lowest
2144 * rate. */ 2121 * rate. */
2145 fc = hdr->frame_control; 2122 fc = hdr->frame_control;
2146 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || 2123 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
2147 !sta || !sta->rate_ctrl_priv) { 2124 !sta || !priv_sta) {
2148 sel->rate_idx = rate_lowest_index(local, sband, sta); 2125 sel->rate_idx = rate_lowest_index(sband, sta);
2149 goto out; 2126 return;
2150 } 2127 }
2151 2128
2152 lq_sta = (struct iwl_lq_sta *)sta->rate_ctrl_priv; 2129 lq_sta = (struct iwl_lq_sta *)priv_sta;
2153 i = lq_sta->last_txrate_idx; 2130 i = lq_sta->last_txrate_idx;
2154 2131
2155 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 2132 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
@@ -2167,23 +2144,22 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
2167 lq_sta->lq.sta_id = sta_id; 2144 lq_sta->lq.sta_id = sta_id;
2168 lq_sta->lq.rs_table[0].rate_n_flags = 0; 2145 lq_sta->lq.rs_table[0].rate_n_flags = 0;
2169 lq_sta->ibss_sta_added = 1; 2146 lq_sta->ibss_sta_added = 1;
2170 rs_initialize_lq(priv, conf, sta); 2147 rs_initialize_lq(priv, conf, sta, lq_sta);
2171 } 2148 }
2172 } 2149 }
2173 2150
2174 if ((i < 0) || (i > IWL_RATE_COUNT)) { 2151 if ((i < 0) || (i > IWL_RATE_COUNT)) {
2175 sel->rate_idx = rate_lowest_index(local, sband, sta); 2152 sel->rate_idx = rate_lowest_index(sband, sta);
2176 goto out; 2153 return;
2177 } 2154 }
2178 2155
2179 if (sband->band == IEEE80211_BAND_5GHZ) 2156 if (sband->band == IEEE80211_BAND_5GHZ)
2180 i -= IWL_FIRST_OFDM_RATE; 2157 i -= IWL_FIRST_OFDM_RATE;
2181 sel->rate_idx = i; 2158 sel->rate_idx = i;
2182out:
2183 rcu_read_unlock();
2184} 2159}
2185 2160
2186static void *rs_alloc_sta(void *priv_rate, gfp_t gfp) 2161static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
2162 gfp_t gfp)
2187{ 2163{
2188 struct iwl_lq_sta *lq_sta; 2164 struct iwl_lq_sta *lq_sta;
2189 struct iwl_priv *priv; 2165 struct iwl_priv *priv;
@@ -2206,20 +2182,16 @@ static void *rs_alloc_sta(void *priv_rate, gfp_t gfp)
2206 return lq_sta; 2182 return lq_sta;
2207} 2183}
2208 2184
2209static void rs_rate_init(void *priv_rate, void *priv_sta, 2185static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
2210 struct ieee80211_local *local, 2186 struct ieee80211_sta *sta, void *priv_sta)
2211 struct sta_info *sta)
2212{ 2187{
2213 int i, j; 2188 int i, j;
2214 struct ieee80211_conf *conf = &local->hw.conf; 2189 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2215 struct ieee80211_supported_band *sband; 2190 struct ieee80211_conf *conf = &priv->hw->conf;
2216 struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
2217 struct iwl_lq_sta *lq_sta = priv_sta; 2191 struct iwl_lq_sta *lq_sta = priv_sta;
2218 2192
2219 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
2220
2221 lq_sta->flush_timer = 0; 2193 lq_sta->flush_timer = 0;
2222 lq_sta->supp_rates = sta->sta.supp_rates[sband->band]; 2194 lq_sta->supp_rates = sta->supp_rates[sband->band];
2223 for (j = 0; j < LQ_SIZE; j++) 2195 for (j = 0; j < LQ_SIZE; j++)
2224 for (i = 0; i < IWL_RATE_COUNT; i++) 2196 for (i = 0; i < IWL_RATE_COUNT; i++)
2225 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); 2197 rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
@@ -2232,17 +2204,17 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2232 2204
2233 lq_sta->ibss_sta_added = 0; 2205 lq_sta->ibss_sta_added = 0;
2234 if (priv->iw_mode == NL80211_IFTYPE_AP) { 2206 if (priv->iw_mode == NL80211_IFTYPE_AP) {
2235 u8 sta_id = iwl_find_station(priv, sta->sta.addr); 2207 u8 sta_id = iwl_find_station(priv, sta->addr);
2236 DECLARE_MAC_BUF(mac); 2208 DECLARE_MAC_BUF(mac);
2237 2209
2238 /* for IBSS the call are from tasklet */ 2210 /* for IBSS the call are from tasklet */
2239 IWL_DEBUG_RATE("LQ: ADD station %s\n", 2211 IWL_DEBUG_RATE("LQ: ADD station %s\n",
2240 print_mac(mac, sta->sta.addr)); 2212 print_mac(mac, sta->addr));
2241 2213
2242 if (sta_id == IWL_INVALID_STATION) { 2214 if (sta_id == IWL_INVALID_STATION) {
2243 IWL_DEBUG_RATE("LQ: ADD station %s\n", 2215 IWL_DEBUG_RATE("LQ: ADD station %s\n",
2244 print_mac(mac, sta->sta.addr)); 2216 print_mac(mac, sta->addr));
2245 sta_id = iwl_add_station_flags(priv, sta->sta.addr, 2217 sta_id = iwl_add_station_flags(priv, sta->addr,
2246 0, CMD_ASYNC, NULL); 2218 0, CMD_ASYNC, NULL);
2247 } 2219 }
2248 if ((sta_id != IWL_INVALID_STATION)) { 2220 if ((sta_id != IWL_INVALID_STATION)) {
@@ -2256,11 +2228,11 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2256 /* Find highest tx rate supported by hardware and destination station */ 2228 /* Find highest tx rate supported by hardware and destination station */
2257 lq_sta->last_txrate_idx = 3; 2229 lq_sta->last_txrate_idx = 3;
2258 for (i = 0; i < sband->n_bitrates; i++) 2230 for (i = 0; i < sband->n_bitrates; i++)
2259 if (sta->sta.supp_rates[sband->band] & BIT(i)) 2231 if (sta->supp_rates[sband->band] & BIT(i))
2260 lq_sta->last_txrate_idx = i; 2232 lq_sta->last_txrate_idx = i;
2261 2233
2262 /* For MODE_IEEE80211A, skip over cck rates in global rate table */ 2234 /* For MODE_IEEE80211A, skip over cck rates in global rate table */
2263 if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) 2235 if (sband->band == IEEE80211_BAND_5GHZ)
2264 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2236 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
2265 2237
2266 lq_sta->is_dup = 0; 2238 lq_sta->is_dup = 0;
@@ -2301,7 +2273,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2301 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; 2273 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
2302 lq_sta->drv = priv; 2274 lq_sta->drv = priv;
2303 2275
2304 rs_initialize_lq(priv, conf, sta); 2276 rs_initialize_lq(priv, conf, sta, lq_sta);
2305} 2277}
2306 2278
2307static void rs_fill_link_cmd(const struct iwl_priv *priv, 2279static void rs_fill_link_cmd(const struct iwl_priv *priv,
@@ -2423,9 +2395,9 @@ static void rs_fill_link_cmd(const struct iwl_priv *priv,
2423 lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); 2395 lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000);
2424} 2396}
2425 2397
2426static void *rs_alloc(struct ieee80211_local *local) 2398static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
2427{ 2399{
2428 return local->hw.priv; 2400 return hw->priv;
2429} 2401}
2430/* rate scale requires free function to be implemented */ 2402/* rate scale requires free function to be implemented */
2431static void rs_free(void *priv_rate) 2403static void rs_free(void *priv_rate)
@@ -2446,12 +2418,12 @@ static void rs_clear(void *priv_rate)
2446#endif /* CONFIG_IWLWIFI_DEBUG */ 2418#endif /* CONFIG_IWLWIFI_DEBUG */
2447} 2419}
2448 2420
2449static void rs_free_sta(void *priv_rate, void *priv_sta) 2421static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
2422 void *priv_sta)
2450{ 2423{
2451 struct iwl_lq_sta *lq_sta = priv_sta; 2424 struct iwl_lq_sta *lq_sta = priv_sta;
2452 struct iwl_priv *priv; 2425 struct iwl_priv *priv = priv_r;
2453 2426
2454 priv = (struct iwl_priv *)priv_rate;
2455 IWL_DEBUG_RATE("enter\n"); 2427 IWL_DEBUG_RATE("enter\n");
2456 kfree(lq_sta); 2428 kfree(lq_sta);
2457 IWL_DEBUG_RATE("leave\n"); 2429 IWL_DEBUG_RATE("leave\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 62b26befddc5..d15a2c997954 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -7370,15 +7370,6 @@ static ssize_t show_temperature(struct device *d,
7370 7370
7371static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 7371static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
7372 7372
7373static ssize_t show_rs_window(struct device *d,
7374 struct device_attribute *attr,
7375 char *buf)
7376{
7377 struct iwl3945_priv *priv = d->driver_data;
7378 return iwl3945_fill_rs_info(priv->hw, buf, IWL_AP_ID);
7379}
7380static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL);
7381
7382static ssize_t show_tx_power(struct device *d, 7373static ssize_t show_tx_power(struct device *d,
7383 struct device_attribute *attr, char *buf) 7374 struct device_attribute *attr, char *buf)
7384{ 7375{
@@ -7840,7 +7831,6 @@ static struct attribute *iwl3945_sysfs_entries[] = {
7840#endif 7831#endif
7841 &dev_attr_power_level.attr, 7832 &dev_attr_power_level.attr,
7842 &dev_attr_retry_rate.attr, 7833 &dev_attr_retry_rate.attr,
7843 &dev_attr_rs_window.attr,
7844 &dev_attr_statistics.attr, 7834 &dev_attr_statistics.attr,
7845 &dev_attr_status.attr, 7835 &dev_attr_status.attr,
7846 &dev_attr_temperature.attr, 7836 &dev_attr_temperature.attr,
@@ -7908,6 +7898,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7908 SET_IEEE80211_DEV(hw, &pdev->dev); 7898 SET_IEEE80211_DEV(hw, &pdev->dev);
7909 7899
7910 hw->rate_control_algorithm = "iwl-3945-rs"; 7900 hw->rate_control_algorithm = "iwl-3945-rs";
7901 hw->sta_data_size = sizeof(struct iwl3945_sta_priv);
7911 7902
7912 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); 7903 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
7913 priv = hw->priv; 7904 priv = hw->priv;